[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 1/3] syslogd: avoid spurious ftrunctate() calls for "-b 0"
From:       Joshua Judson Rosen <jrosen () harvestai ! com>
Date:       2014-05-20 5:02:18
Message-ID: 1400562140-16307-1-git-send-email-jrosen () harvestai ! com
[Download RAW message or body]

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>
---
 sysklogd/syslogd.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index a6a4ff2..2c959ff 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
-- 
1.7.10.4

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic