From: Thibault Godouet Date: Tue, 1 Jan 2013 18:13:34 +0000 (+0000) Subject: only call xopenlog when necessary X-Git-Tag: ver3_1_1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c190b017eb7f60b9d424b3901278fd39fb02f288;p=thirdparty%2Ffcron.git only call xopenlog when necessary --- diff --git a/log.c b/log.c index c1df1db..25565e5 100644 --- a/log.c +++ b/log.c @@ -157,9 +157,8 @@ make_msg(const char *append, char *fmt, va_list args) void log_syslog_str(int priority, char *msg) { - xopenlog(); - if (dosyslog) { + xopenlog(); syslog(priority, "%s", msg); } } @@ -170,6 +169,8 @@ log_file_str(FILE *logfile, int priority, char *msg) { xopenlog(); + /* we may have failed to open the logfile - check if + * it does exist *after* xopenlog() */ if (logfile != NULL) { print_line_prefix(logfile, priority); fprintf(logfile, "%s\n", msg);