From 3acac5542f8e97fa84526df271510cbf4dc25529 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 28 Oct 2012 16:49:07 +0100 Subject: [PATCH] set O_APPEND on log fd just in case --- src/utils/debuglog.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/debuglog.cpp b/src/utils/debuglog.cpp index 5e581dc7..bfdc6f06 100644 --- a/src/utils/debuglog.cpp +++ b/src/utils/debuglog.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef INCLUDE_NEW_H #include @@ -84,8 +85,16 @@ class DLFWImpl { fp = stderr; } else { fp = fopen(filename, (truncate) ? "w" : "a"); - if (fp) + if (fp) { setvbuf(fp, 0, _IOLBF, 0); +#ifdef O_APPEND + { + int flgs = 0; + fcntl(fileno(fp), F_GETFL, &flgs); + fcntl(fileno(fp), F_SETFL, flgs|O_APPEND); + } +#endif + } } return; }