From: Christof Hanke Date: Thu, 24 Apr 2014 04:19:32 +0000 (+0200) Subject: Logfiles: open with O_APPEND X-Git-Tag: openafs-stable-1_8_0pre1~689 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=b71a041364d28d6a56905a770cd20d1497ee26ec;hp=f4ab11a8dd562bd7ee11c45e51814281d64c866c 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. Change-Id: I09437aac63205fee3d97850507531e6833fed14f 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 --- diff --git a/src/util/serverLog.c b/src/util/serverLog.c index e2529f5..877f488 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -332,7 +332,7 @@ OpenLog(const char *fileName) /* don't check error */ if (!isfifo) rk_rename(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) {