diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-01-02 19:18:03 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-01-02 19:18:03 +0000 |
commit | 289169081c6a92c0dd6f83c3835b5e4a4dda7736 (patch) | |
tree | 97485feead45783fdcf968b1903aa0e6a754490a /lib/common | |
parent | 0b5e563fb7eaee56207b5b50b362713e19a5bca6 (diff) |
Write memory leak report files to current working directory saved at startup.
Fixes tests broken by changing current directory, for example in bbackupquery,
which meant that the report file was written in the wrong place and couldn't
be found by the test, causing a failure.
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/DebugMemLeakFinder.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index d2109d7b..fb2cc0aa 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -589,7 +589,11 @@ extern "C" void memleakfinder_atexit() void memleakfinder_setup_exit_report(const std::string& filename, const char *markertext) { - ::strncpy(atexit_filename, filename.c_str(), sizeof(atexit_filename)-1); + char buffer[PATH_MAX]; + std::string abs_filename = std::string(getcwd(buffer, sizeof(buffer))) + + DIRECTORY_SEPARATOR + filename; + ::strncpy(atexit_filename, abs_filename.c_str(), + sizeof(atexit_filename)-1); ::strncpy(atexit_markertext, markertext, sizeof(atexit_markertext)-1); atexit_filename[sizeof(atexit_filename)-1] = 0; atexit_markertext[sizeof(atexit_markertext)-1] = 0; |