summaryrefslogtreecommitdiff
path: root/lib/memdebug.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-05-15 00:36:56 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-05-15 00:36:56 +0000
commit3fef839f7514eeeadd5b4574a533146aabc595c5 (patch)
tree306783f4f311abefa22ef8bcf40a6dceaa8e75e2 /lib/memdebug.c
parentea43bb013ba7c2a95d2d29b5a33fc7bd5c01d31a (diff)
downloadcurl-3fef839f7514eeeadd5b4574a533146aabc595c5.tar.gz
Added call to setvbuf (disabled by default for speed) to flush the
memdebug log file after every line and avoid losing the last few log entries if curl crashes.
Diffstat (limited to 'lib/memdebug.c')
-rw-r--r--lib/memdebug.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 110169474..582387cf9 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -73,6 +73,10 @@ void curl_memdebug(const char *logname)
logfile = fopen(logname, "w");
else
logfile = stderr;
+#ifdef MEMDEBUG_LOG_SYNC
+ /* Flush the log file after every line so the log isn't lost in a crash */
+ setvbuf(logfile, (char *)NULL, _IOLBF, 0);
+#endif
}
}