From: Wayne Davison Date: Fri, 28 Jan 2005 17:42:21 +0000 (+0000) Subject: Made log_open() static and made it die with an error if the X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/63ecee4d1ae76134d3ebd6272d2157f059b2cab6?ds=sidebyside;hp=4c8f6b6a0606a67716435da707057d8fa5f2e12d Made log_open() static and made it die with an error if the log-file can't be opened. --- 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) {