Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r--sysklogd/syslogd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 2f0ca6ac5..fc380d9f9 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -278,7 +278,7 @@ static void parse_syslogdcfg(const char *file)
parser_t *parser;
parser = config_open2(file ? file : "/etc/syslog.conf",
- file ? xfopen_for_read : fopen_or_warn_stdin);
+ file ? xfopen_for_read : fopen_for_read);
if (!parser)
/* didn't find default /etc/syslog.conf */
/* proceed as if we built busybox without config support */
@@ -594,6 +594,14 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file)
}
/* newFile == "f.0" now */
rename(log_file->path, newFile);
+ /* Incredibly, if F and F.0 are hardlinks, POSIX
+ * _demands_ that rename returns 0 but does not
+ * remove F!!!
+ * (hardlinked F/F.0 pair was observed after
+ * power failure during rename()).
+ * Ensure old file is gone:
+ */
+ unlink(log_file->path);
#ifdef SYSLOGD_WRLOCK
fl.l_type = F_UNLCK;
fcntl(log_file->fd, F_SETLKW, &fl);
@@ -678,7 +686,7 @@ static void timestamp_and_log(int pri, char *msg, int len)
if (LOG_PRI(pri) < G.logLevel) {
#if ENABLE_FEATURE_IPC_SYSLOG
if ((option_mask32 & OPT_circularlog) && G.shbuf) {
- log_to_shmem(msg);
+ log_to_shmem(G.printbuf);
return;
}
#endif