aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-04 01:33:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-04 01:33:22 +0000
commitbc7177187f6b4f32c2f9562358294dfc7b521f67 (patch)
tree3730020ba2f9caeb9d7815a975af51830b51ce11
parent8bc376bc12225a62c64269f9ce82d89860519ed7 (diff)
downloadbusybox-w32-1_13_3.tar.gz
busybox-w32-1_13_3.tar.bz2
busybox-w32-1_13_3.zip
syslogd: fix new log file mode 0600 -> 0666 (as usual, affected by umask)1_13_3
Diffstat (limited to '')
-rw-r--r--sysklogd/syslogd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 38ea3d7ff..f624eb7f6 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -301,17 +301,23 @@ static void log_locally(time_t now, char *msg)
301 } 301 }
302#endif 302#endif
303 if (G.logFD >= 0) { 303 if (G.logFD >= 0) {
304 /* Reopen log file every second. This allows admin
305 * to delete the file and not worry about restarting us.
306 * This costs almost nothing since it happens
307 * _at most_ once a second.
308 */
304 if (!now) 309 if (!now)
305 now = time(NULL); 310 now = time(NULL);
306 if (G.last_log_time != now) { 311 if (G.last_log_time != now) {
307 G.last_log_time = now; /* reopen log file every second */ 312 G.last_log_time = now;
308 close(G.logFD); 313 close(G.logFD);
309 goto reopen; 314 goto reopen;
310 } 315 }
311 } else { 316 } else {
312 reopen: 317 reopen:
313 G.logFD = device_open(G.logFilePath, O_WRONLY | O_CREAT 318 G.logFD = open(G.logFilePath, O_WRONLY | O_CREAT
314 | O_NOCTTY | O_APPEND | O_NONBLOCK); 319 | O_NOCTTY | O_APPEND | O_NONBLOCK,
320 0666);
315 if (G.logFD < 0) { 321 if (G.logFD < 0) {
316 /* cannot open logfile? - print to /dev/console then */ 322 /* cannot open logfile? - print to /dev/console then */
317 int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK); 323 int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK);