From: Christof Hanke Date: Thu, 24 Apr 2014 04:19:32 +0000 (+0200) Subject: Logfiles: open with O_APPEND X-Git-Tag: upstream/1.6.10_pre1^2~110 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=7cfb8d388ee64a05aa01cef6f60ef1e89817e0f7;p=packages%2Fo%2Fopenafs.git Logfiles: open with O_APPEND This does not change the current (normal) behaviour, but allows logrotation via "copy and truncate" as offered by logrotate. Otherwise the processes will remember the offset of the last write and a truncated file is filled with '\0' until the current offset. The mrafsStyleLogs are untouched, since they can be rotated by a kill -HUP and are deprecated anyway. Reviewed-on: http://gerrit.openafs.org/11092 Reviewed-by: Nathaniel Filardo Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Michael Meffie Reviewed-by: D Brashear Tested-by: D Brashear (cherry picked from commit b71a041364d28d6a56905a770cd20d1497ee26ec) Change-Id: Idc148f4d6b9302d25cbf32763d08ee24eaf7378b Reviewed-on: http://gerrit.openafs.org/11193 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Perry Ruiter Reviewed-by: Stephan Wiesand --- diff --git a/src/util/serverLog.c b/src/util/serverLog.c index 4cf81febc..aaa499203 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -351,7 +351,7 @@ OpenLog(const char *fileName) /* don't check error */ if (!isfifo) renamefile(fileName, oldName); - tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | (isfifo?O_NONBLOCK:0), 0666); + tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | O_APPEND | (isfifo?O_NONBLOCK:0), 0666); } if (tempfd < 0) {