]> granicus.if.org Git - fcron/commitdiff
Modifications to log.c to ensure that a log file specified in fcron.conf takes preced...
authorMatt Signorini <matthew.signorini@gmail.com>
Thu, 27 Dec 2012 05:06:56 +0000 (16:06 +1100)
committerThibault Godouet <fcron@free.fr>
Mon, 31 Dec 2012 16:48:41 +0000 (16:48 +0000)
log.c

diff --git a/log.c b/log.c
index f27b67241796629cdf35bf34c4d84b6178f173f6..944f7c05252050cf0523ca8fe21c025cda62538d 100644 (file)
--- a/log.c
+++ b/log.c
@@ -68,7 +68,7 @@ xopenlog(void)
        return;
 
     // are we using syslog?
-    if (dosyslog) {
+    if (dosyslog && (fcronlog == NULL)) {
        openlog(prog_name, LOG_PID, SYSLOG_FACILITY);
     } else if (fcronlog != NULL) {
        logfd = fopen(fcronlog, "a+");
@@ -85,7 +85,7 @@ xcloselog()
        return;
 
     // check whether we need to close syslog, or a file.
-    if (dosyslog) {
+    if (dosyslog && (fcronlog == NULL)) {
        closelog();
     } else if (fcronlog != NULL) {
        fclose(logfd);
@@ -126,9 +126,9 @@ log_syslog_str(int priority, char *msg)
 {
     xopenlog();
 
-    if (dosyslog) {
+    if (dosyslog && (logfd == NULL)) {
        syslog(priority, "%s", msg);
-    } else if ( logfd != NULL ) {
+    } else if (logfd != NULL) {
        fcronlog(priority, msg);
     }