diff options
Diffstat (limited to 'syslogd')
-rw-r--r-- | syslogd/logfile.c | 3 | ||||
-rw-r--r-- | syslogd/logfile.h | 3 | ||||
-rw-r--r-- | syslogd/main.c | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/syslogd/logfile.c b/syslogd/logfile.c index a59f7e7..5687750 100644 --- a/syslogd/logfile.c +++ b/syslogd/logfile.c @@ -25,7 +25,7 @@ #include "logfile.h" -logfile_t *logfile_create(const char *name) +logfile_t *logfile_create(const char *name, int facility) { logfile_t *file; @@ -36,6 +36,7 @@ logfile_t *logfile_create(const char *name) } strcpy(file->name, name); + file->facility = facility; file->fd = open(file->name, O_WRONLY | O_CREAT, 0640); if (file->fd < 0) diff --git a/syslogd/logfile.h b/syslogd/logfile.h index 58da272..cf4a7d6 100644 --- a/syslogd/logfile.h +++ b/syslogd/logfile.h @@ -20,12 +20,13 @@ typedef struct logfile_t { struct logfile_t *next; + int facility; int fd; char name[]; } logfile_t; -logfile_t *logfile_create(const char *name); +logfile_t *logfile_create(const char *name, int facility); void logfile_destroy(logfile_t *file); diff --git a/syslogd/main.c b/syslogd/main.c index b1b70b0..79d6325 100644 --- a/syslogd/main.c +++ b/syslogd/main.c @@ -134,12 +134,12 @@ static int print_to_log(const syslog_msg_t *msg) return -1; for (log = logfiles; log != NULL; log = log->next) { - if (!strcmp(log->name, fac_name)) + if (log->facility == msg->facility) break; } if (log == NULL) { - log = logfile_create(fac_name); + log = logfile_create(fac_name, msg->facility); if (log == NULL) return -1; log->next = logfiles; |