Browse Source

Use only one fprintf in console logging to minimise risk of overlap

master
ckolivas 11 years ago
parent
commit
10baacbeee
  1. 6
      src/ckpool.c

6
src/ckpool.c

@ -64,10 +64,10 @@ void logmsg(int loglevel, const char *fmt, ...) {
flock(logfd, LOCK_UN); flock(logfd, LOCK_UN);
} }
if (loglevel <= LOG_WARNING) {\ if (loglevel <= LOG_WARNING) {\
fprintf(stderr, "%s", buf);
if (loglevel <= LOG_ERR && errno != 0) if (loglevel <= LOG_ERR && errno != 0)
fprintf(stderr, " with errno %d: %s", errno, strerror(errno)); fprintf(stderr, "%s with errno %d: %s\n", buf, errno, strerror(errno));
fprintf(stderr, "\n"); else
fprintf(stderr, "%s\n", buf);
fflush(stderr); fflush(stderr);
} }
free(buf); free(buf);

Loading…
Cancel
Save