From: Joshua Judson Rosen Date: Tue, 20 May 2014 05:02:18 +0000 (-0400) Subject: syslogd: avoid spurious ftrunctate() calls for "-b 0" X-Git-Tag: 1_23_0~109 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1b90e031c3a3bd6dc5c2a34193ec6e9727b79a39;p=oweals%2Fbusybox.git syslogd: avoid spurious ftrunctate() calls for "-b 0" Forgetting to re-set log_file->size after truncating to zero discards log-data for the next 1 second following an oversize-induced purge, when we shouldn't necessarily throw that data away. Signed-off-by: Joshua Judson Rosen Signed-off-by: Denys Vlasenko --- diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index a6a4ff25c..2c959ff1b 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -663,7 +663,13 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file) close(log_file->fd); goto reopen; } + + /* We don't get here unless G.logFileRotate == 0; + * in which case don't bother unlinking and reopening, + * just truncate and reset size to match: + */ ftruncate(log_file->fd, 0); + log_file->size = 0; } log_file->size += #endif