[Box Backup-commit] COMMIT r3508 - box/trunk/lib/common

subversion at boxbackup.org subversion at boxbackup.org
Fri Jan 2 19:18:03 GMT 2015


Author: chris
Date: 2015-01-02 19:18:03 +0000 (Fri, 02 Jan 2015)
New Revision: 3508

Modified:
   box/trunk/lib/common/DebugMemLeakFinder.cpp
Log:
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.

Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/trunk/lib/common/DebugMemLeakFinder.cpp	2015-01-02 19:17:58 UTC (rev 3507)
+++ box/trunk/lib/common/DebugMemLeakFinder.cpp	2015-01-02 19:18:03 UTC (rev 3508)
@@ -589,7 +589,11 @@
 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;




More information about the Boxbackup-commit mailing list