Made log_open() static and made it die with an error if the
[rsync/rsync.git] / log.c
diff --git a/log.c b/log.c
index f63de7f..6d96919 100644 (file)
--- 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) {