Browse Source

Only show errno if it's not zero

master
ckolivas 11 years ago
parent
commit
2b9062b44e
  1. 4
      src/ckpool.c

4
src/ckpool.c

@ -58,7 +58,7 @@ void logmsg(int loglevel, const char *fmt, ...) {
tm->tm_min, tm->tm_min,
tm->tm_sec, tm->tm_sec,
buf); buf);
if (loglevel <= LOG_ERR) if (loglevel <= LOG_ERR && errno != 0)
fprintf(LOGFP, " with errno %d: %s", errno, strerror(errno)); fprintf(LOGFP, " with errno %d: %s", errno, strerror(errno));
fprintf(LOGFP, "\n"); fprintf(LOGFP, "\n");
fflush(LOGFP); fflush(LOGFP);
@ -66,7 +66,7 @@ void logmsg(int loglevel, const char *fmt, ...) {
} }
if (loglevel <= LOG_WARNING) {\ if (loglevel <= LOG_WARNING) {\
fprintf(stderr, "%s", buf); fprintf(stderr, "%s", buf);
if (loglevel <= LOG_ERR) if (loglevel <= LOG_ERR && errno != 0)
fprintf(stderr, " with errno %d: %s", errno, strerror(errno)); fprintf(stderr, " with errno %d: %s", errno, strerror(errno));
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);

Loading…
Cancel
Save