aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Judson Rosen <jrosen@harvestai.com>2014-05-20 01:02:18 -0400
committerDenys Vlasenko <vda.linux@googlemail.com>2014-06-02 03:11:38 +0200
commit1b90e031c3a3bd6dc5c2a34193ec6e9727b79a39 (patch)
treedbf16a94e27d0ce62985c48417eb3fe732ba1f7f
parentfd0640e5a12f74b7ab1d918cf884df0c59402c5a (diff)
downloadbusybox-w32-1b90e031c3a3bd6dc5c2a34193ec6e9727b79a39.tar.gz
busybox-w32-1b90e031c3a3bd6dc5c2a34193ec6e9727b79a39.tar.bz2
busybox-w32-1b90e031c3a3bd6dc5c2a34193ec6e9727b79a39.zip
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 <jrosen@harvestai.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--sysklogd/syslogd.c6
1 files changed, 6 insertions, 0 deletions
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)
663 close(log_file->fd); 663 close(log_file->fd);
664 goto reopen; 664 goto reopen;
665 } 665 }
666
667 /* We don't get here unless G.logFileRotate == 0;
668 * in which case don't bother unlinking and reopening,
669 * just truncate and reset size to match:
670 */
666 ftruncate(log_file->fd, 0); 671 ftruncate(log_file->fd, 0);
672 log_file->size = 0;
667 } 673 }
668 log_file->size += 674 log_file->size +=
669#endif 675#endif