From: Sami Kerola Date: Sat, 28 Jun 2014 22:49:06 +0000 (+0100) Subject: logger: make --stderr print remote server messages X-Git-Tag: v2.26-rc1~576^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4288f9f12c892499f08ba4673c34dc1bedc5dc59;p=thirdparty%2Futil-linux.git logger: make --stderr print remote server messages Users wish to see the message should include also remote messages, not only the one sent to locally via libc function. Signed-off-by: Sami Kerola --- diff --git a/misc-utils/logger.c b/misc-utils/logger.c index c1af7350c0..7239cc5b85 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -320,6 +320,8 @@ static void syslog_rfc3164(struct logger_ctl *ctl, char *msg) ctl->pri, tp, cp, pid, msg); if (write_all(ctl->fd, buf, strlen(buf) + 1) < 0) warn(_("write failed")); + if (ctl->logflags & LOG_PERROR) + fprintf(stderr, "%s\n", buf); } static void syslog_rfc5424(struct logger_ctl *ctl, char *msg) @@ -377,6 +379,8 @@ static void syslog_rfc5424(struct logger_ctl *ctl, char *msg) if (write_all(ctl->fd, buf, strlen(buf) + 1) < 0) warn(_("write failed")); free(hostname); + if (ctl->logflags & LOG_PERROR) + fprintf(stderr, "%s\n", buf); free(buf); }