diff options
-rw-r--r-- | sysklogd/syslogd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index d36d09caf..fc380d9f9 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -594,6 +594,14 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file) | |||
594 | } | 594 | } |
595 | /* newFile == "f.0" now */ | 595 | /* newFile == "f.0" now */ |
596 | rename(log_file->path, newFile); | 596 | rename(log_file->path, newFile); |
597 | /* Incredibly, if F and F.0 are hardlinks, POSIX | ||
598 | * _demands_ that rename returns 0 but does not | ||
599 | * remove F!!! | ||
600 | * (hardlinked F/F.0 pair was observed after | ||
601 | * power failure during rename()). | ||
602 | * Ensure old file is gone: | ||
603 | */ | ||
604 | unlink(log_file->path); | ||
597 | #ifdef SYSLOGD_WRLOCK | 605 | #ifdef SYSLOGD_WRLOCK |
598 | fl.l_type = F_UNLCK; | 606 | fl.l_type = F_UNLCK; |
599 | fcntl(log_file->fd, F_SETLKW, &fl); | 607 | fcntl(log_file->fd, F_SETLKW, &fl); |