X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/58b1999e086721ff77d8f3d5e0d29e1e58c70a94..63ecee4d1ae76134d3ebd6272d2157f059b2cab6:/log.c diff --git a/log.c b/log.c index 0b55457f..6d969193 100644 --- a/log.c +++ b/log.c @@ -61,7 +61,7 @@ struct { { RERR_WAITCHILD , "some error returned by waitpid()" }, { RERR_MALLOC , "error allocating core memory buffers" }, { RERR_PARTIAL , "some files could not be transferred" }, - { RERR_VANISHED , "some files vanished before they could be transfered" }, + { RERR_VANISHED , "some files vanished before they could be transferred" }, { RERR_TIMEOUT , "timeout in data send/receive" }, { RERR_CMD_FAILED , "remote shell failed" }, { RERR_CMD_KILLED , "remote shell killed" }, @@ -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) {