]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: make --stderr print remote server messages
authorSami Kerola <kerolasa@iki.fi>
Sat, 28 Jun 2014 22:49:06 +0000 (23:49 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 28 Jul 2014 20:15:18 +0000 (21:15 +0100)
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 <kerolasa@iki.fi>
misc-utils/logger.c

index c1af7350c0e3fb146c238ad8841374233f08d917..7239cc5b85d5d7eeff69a7d52f8259e02965b23c 100644 (file)
@@ -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);
 }