# HG changeset patch # User Carl Byington # Date 1368818553 25200 # Node ID a043b7d7269cfd38f55293aef0582a63ee1d6cb5 # Parent efe0b291233a68c99e8542040747daca5ea6fada truncate output files after processing them diff -r efe0b291233a -r a043b7d7269c src/wflogs-config.cpp --- a/src/wflogs-config.cpp Fri May 17 12:06:21 2013 -0700 +++ b/src/wflogs-config.cpp Fri May 17 12:22:33 2013 -0700 @@ -77,7 +77,9 @@ void CONTEXT::openo(bool msg) { open_time = time(NULL); localtime_r(&open_time, &open_tm); - fdo = ::open(tempin, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + int flags = O_CREAT | O_WRONLY; + if (!msg) flags |= O_TRUNC; + fdo = ::open(tempin, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fdo == -1) { if (msg) { char buf[maxlen]; @@ -110,7 +112,7 @@ if (fstat(fd, &openfdstat)) { close(); snprintf(buf, sizeof(buf), "syslog file %s cannot stat after open", fn); - tokp->token_error(buf); + if (msg) tokp->token_error(buf); } // specify that this fd gets closed on exec, so that wflogs // won't have access to it.