syslog support in rsync daemon has been broken since I added the "log
authorAndrew Tridgell <tridge@samba.org>
Wed, 28 Oct 1998 10:43:31 +0000 (10:43 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 28 Oct 1998 10:43:31 +0000 (10:43 +0000)
file" option. I wonder why noone reported it? Or did everyone just use
"log file" ?

cleanup.c
clientserver.c
log.c

index abd7b0d..b4eac0c 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -51,8 +51,12 @@ void exit_cleanup(int code)
        if (code) {
                kill_all(SIGUSR1);
        }
-       if ((cleanup_pid != 0) && (cleanup_pid == (int) getpid()))
-               unlink(lp_pid_file());
+       if ((cleanup_pid != 0) && (cleanup_pid == (int) getpid())) {
+               char *pidf = lp_pid_file();
+               if (pidf && *pidf) {
+                       unlink(lp_pid_file());
+               }
+       }
        exit(code);
 }
 
index debc4fe..f7293bf 100644 (file)
@@ -353,7 +353,7 @@ static int start_daemon(int fd)
        io_printf(fd,"@RSYNCD: %d\n", PROTOCOL_VERSION);
 
        motd = lp_motd_file();
-       if (*motd) {
+       if (motd && *motd) {
                FILE *f = fopen(motd,"r");
                while (f && !feof(f)) {
                        int len = fread(line, 1, sizeof(line)-1, f);
diff --git a/log.c b/log.c
index a586793..a3f7787 100644 (file)
--- a/log.c
+++ b/log.c
@@ -63,12 +63,14 @@ void log_open(void)
        static int initialised;
        int options = LOG_PID;
        time_t t;
+       char *logf;
 
        if (initialised) return;
        initialised = 1;
 
-       if (lp_log_file()) {
-               logfile = fopen(lp_log_file(), "a");
+       logf = lp_log_file();
+       if (logf && *logf) {
+               logfile = fopen(logf, "a");
                return;
        }