syslogd: remember to un-writelock log-files even when called with "-b 0"
authorJoshua Judson Rosen <jrosen@harvestai.com>
Tue, 20 May 2014 05:02:19 +0000 (01:02 -0400)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 2 Jun 2014 01:11:39 +0000 (03:11 +0200)
Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sysklogd/syslogd.c

index 2c959ff1bf68e7578df8ab416b03ee776bcce89a..d77fc9475433cac565bc37ea39719c3ab3be8401 100644 (file)
@@ -670,6 +670,10 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file)
                 */
                ftruncate(log_file->fd, 0);
                log_file->size = 0;
+#ifdef SYSLOGD_WRLOCK
+               fl.l_type = F_UNLCK;
+               fcntl(log_file->fd, F_SETLKW, &fl);
+#endif
        }
        log_file->size +=
 #endif