Ping. Can this be applied upstream?

On 2014-05-22 15:42, Joshua Judson Rosen wrote:
Even if we fail to write to a log-file, and it's not growing,
it's not *shrinking* either....

Signed-off-by: Joshua Judson Rosen <jro...@harvestai.com>
---
  sysklogd/syslogd.c |   11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index a6a4ff2..ca926b9 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -584,6 +584,9 @@ static void log_locally(time_t now, char *msg, logFile_t 
*log_file)
        struct flock fl;
  #endif
        int len = strlen(msg);
+#if ENABLE_FEATURE_ROTATE_LOGFILE
+       int len_written;
+#endif

        if (log_file->fd >= 0) {
                /* Reopen log file every second. This allows admin
@@ -665,9 +668,15 @@ static void log_locally(time_t now, char *msg, logFile_t 
*log_file)
                }
                ftruncate(log_file->fd, 0);
        }
-       log_file->size +=
+
+       len_written =
  #endif
                        full_write(log_file->fd, msg, len);
+#if ENABLE_FEATURE_ROTATE_LOGFILE
+       if (len_written >= 0) {
+               log_file->size += len_written;
+       }
+#endif
  #ifdef SYSLOGD_WRLOCK
        fl.l_type = F_UNLCK;
        fcntl(log_file->fd, F_SETLKW, &fl);


--
"'tis an ill wind that blows no minds."
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to