diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-02 14:26:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-02 14:26:28 +0000 |
commit | d9415d6335b73a67512667497f7a0a0bd5774b2d (patch) | |
tree | e2e42c9c49f4520cd56ecc936e14442575abb432 | |
parent | 37ad6b323de2a7e7aabbd8e8c2f00a511548ae8b (diff) | |
download | busybox-d9415d6335b73a67512667497f7a0a0bd5774b2d.tar.gz |
syslogd: create logfile with 0666, not 0600.
-rw-r--r-- | sysklogd/syslogd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 48b875ef1..89391036a 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -306,17 +306,23 @@ static void log_locally(time_t now, char *msg) } #endif if (G.logFD >= 0) { + /* Reopen log file every second. This allows admin + * to delete the file and not worry about restarting us. + * This costs almost nothing since it happens + * _at most_ once a second. + */ if (!now) now = time(NULL); if (G.last_log_time != now) { - G.last_log_time = now; /* reopen log file every second */ + G.last_log_time = now; close(G.logFD); goto reopen; } } else { reopen: - G.logFD = device_open(G.logFilePath, O_WRONLY | O_CREAT - | O_NOCTTY | O_APPEND | O_NONBLOCK); + G.logFD = open(G.logFilePath, O_WRONLY | O_CREAT + | O_NOCTTY | O_APPEND | O_NONBLOCK, + 0666); if (G.logFD < 0) { /* cannot open logfile? - print to /dev/console then */ int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK); |