diff --git a/src/syslogd.c b/src/syslogd.c index 0229b21..29f675f 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -61,21 +61,18 @@ static char sccsid[] __attribute__((unused)) = #include #include #include -#include #include #include #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -1319,7 +1316,7 @@ void logrotate(struct filed *f) (void)rename(f->f_un.f_fname, newFile); close(f->f_file); - f->f_file = open(f->f_un.f_fname, O_WRONLY | O_APPEND | O_CREAT | O_NONBLOCK | O_NOCTTY, 0644); + f->f_file = open(f->f_un.f_fname, O_CREATE | O_NONBLOCK | O_NOCTTY, 0644); if (f->f_file < 0) { f->f_type = F_UNUSED; ERR("Failed re-opening log file %s after rotation", f->f_un.f_fname); @@ -2497,8 +2494,7 @@ static struct filed *cfline(char *line) f->f_file = open(++p, O_RDWR | O_NONBLOCK | O_NOCTTY); f->f_type = F_PIPE; } else { - f->f_file = open(p, O_WRONLY | O_APPEND | O_CREAT | O_NONBLOCK | O_NOCTTY, - 0644); + f->f_file = open(p, O_CREATE | O_NONBLOCK | O_NOCTTY, 0644); f->f_type = F_FILE; } diff --git a/src/syslogd.h b/src/syslogd.h index 15e7b28..ba9e526 100644 --- a/src/syslogd.h +++ b/src/syslogd.h @@ -34,12 +34,15 @@ #include "config.h" +#include #include /* struct addrinfo */ #ifdef __linux__ #include #endif #include /* MAXHOSTNAMELEN */ #include +#include +#include #include /* struct sockaddr_un */ #include "queue.h" #include "syslog.h" @@ -117,6 +120,8 @@ #define AI_SECURE 0x8000 /* Tell socket_create() to not bind() */ +#define O_CREATE O_WRONLY | O_APPEND | O_CREAT + /* From The Practice of Programming, by Kernighan and Pike */ #ifndef NELEMS #define NELEMS(array) (sizeof(array) / sizeof(array[0]))