syslogd: create logfile with 0666, not 0600.
This commit is contained in:
parent
37ad6b323d
commit
d9415d6335
@ -306,17 +306,23 @@ static void log_locally(time_t now, char *msg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (G.logFD >= 0) {
|
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)
|
if (!now)
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
if (G.last_log_time != now) {
|
if (G.last_log_time != now) {
|
||||||
G.last_log_time = now; /* reopen log file every second */
|
G.last_log_time = now;
|
||||||
close(G.logFD);
|
close(G.logFD);
|
||||||
goto reopen;
|
goto reopen;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reopen:
|
reopen:
|
||||||
G.logFD = device_open(G.logFilePath, O_WRONLY | O_CREAT
|
G.logFD = open(G.logFilePath, O_WRONLY | O_CREAT
|
||||||
| O_NOCTTY | O_APPEND | O_NONBLOCK);
|
| O_NOCTTY | O_APPEND | O_NONBLOCK,
|
||||||
|
0666);
|
||||||
if (G.logFD < 0) {
|
if (G.logFD < 0) {
|
||||||
/* cannot open logfile? - print to /dev/console then */
|
/* cannot open logfile? - print to /dev/console then */
|
||||||
int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK);
|
int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK);
|
||||||
|
Loading…
Reference in New Issue
Block a user