From 27d3cdbc943a57d64f4f2a35a4f1e1b15d9ca41f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 28 Oct 1998 10:43:31 +0000 Subject: [PATCH] syslog support in rsync daemon has been broken since I added the "log file" option. I wonder why noone reported it? Or did everyone just use "log file" ? --- cleanup.c | 8 ++++++-- clientserver.c | 2 +- log.c | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cleanup.c b/cleanup.c index abd7b0df..b4eac0c4 100644 --- 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); } diff --git a/clientserver.c b/clientserver.c index debc4fec..f7293bf5 100644 --- a/clientserver.c +++ b/clientserver.c @@ -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 a5867932..a3f77874 100644 --- 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; } -- 2.34.1