commit 03d2db037569b380e1ba5cadfb45ce69db3b679e
parent 20a0fac5b8d3f126cf50c6e7e9b0e6b82cabc7c3
Author: sin <sin@2f30.org>
Date: Wed, 9 Jul 2014 08:24:31 +0100
When daemonized do not try to log to stderr
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/crond.c b/crond.c
@@ -61,7 +61,8 @@ loginfo(const char *fmt, ...)
va_start(ap, fmt);
if (nflag == 0)
vsyslog(LOG_INFO, fmt, ap);
- vfprintf(stdout, fmt, ap);
+ else
+ vfprintf(stdout, fmt, ap);
fflush(stdout);
va_end(ap);
}
@@ -73,7 +74,8 @@ logwarn(const char *fmt, ...)
va_start(ap, fmt);
if (nflag == 0)
vsyslog(LOG_WARNING, fmt, ap);
- vfprintf(stderr, fmt, ap);
+ else
+ vfprintf(stderr, fmt, ap);
va_end(ap);
}
@@ -84,7 +86,8 @@ logerr(const char *fmt, ...)
va_start(ap, fmt);
if (nflag == 0)
vsyslog(LOG_ERR, fmt, ap);
- vfprintf(stderr, fmt, ap);
+ else
+ vfprintf(stderr, fmt, ap);
va_end(ap);
}