summaryrefslogtreecommitdiff
path: root/recipes/busybox/busybox-1.13.2/busybox-1.13.2-syslogd.patch
blob: 1c24cdcc55c3a24ff92d13a5310b63c230e67abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
diff -urpN busybox-1.13.2/sysklogd/syslogd.c busybox-1.13.2-syslogd/sysklogd/syslogd.c
--- busybox-1.13.2/sysklogd/syslogd.c	2008-11-09 18:28:03.000000000 +0100
+++ busybox-1.13.2-syslogd/sysklogd/syslogd.c	2009-03-08 02:03:24.000000000 +0100
@@ -301,17 +301,23 @@ static void log_locally(time_t now, char
 	}
 #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);