From 63ecee4d1ae76134d3ebd6272d2157f059b2cab6 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 28 Jan 2005 17:42:21 +0000 Subject: [PATCH] Made log_open() static and made it die with an error if the log-file can't be opened. --- log.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/log.c b/log.c index f63de7f5..6d969193 100644 --- a/log.c +++ b/log.c @@ -85,6 +85,20 @@ static char const *rerr_name(int code) return NULL; } +static void log_open(void) +{ + if (logfname && !logfile) { + extern int orig_umask; + int old_umask = umask(022 | orig_umask); + logfile = fopen(logfname, "a"); + umask(old_umask); + if (!logfile) { + am_daemon = 0; /* avoid trying to log again */ + rsyserr(FERROR, errno, "fopen() of log-file failed"); + exit_cleanup(RERR_FILESELECT); + } + } +} static void logit(int priority, char *buf) { @@ -139,16 +153,6 @@ void log_init(void) #endif } -void log_open(void) -{ - if (logfname && !logfile) { - extern int orig_umask; - int old_umask = umask(022 | orig_umask); - logfile = fopen(logfname, "a"); - umask(old_umask); - } -} - void log_close(void) { if (logfile) { -- 2.34.1