Package: bsdutils
Version: 1:2.20.1-5.3

Hi,

the logger tool from bsdutils comes with an option (-n / --server) for
logging to a remote syslog server (via UDP port 514 by default), e.g.:

  logger -n myloghost -p local0.info "test log message"

However, the message never arrives at myloghost but is instead written to
the local syslog.

I have debugged the issue and found that there are 5 branches in the code
for deciding whether to call syslog(3) or use a socket for sending the
message. The first 3 use 'if (!usock && !udpserver)' while the latter two
incorrectly use 'if (!usock)'. The attached patch fixes this.

-- 
Frank Thilo - [email protected]        IRC: Chestal
--- logger.c	2013-04-11 13:30:48.000000000 +0200
+++ logger.c.fixed	2013-04-11 13:30:48.000000000 +0200
@@ -281,7 +281,7 @@
 			}
 		}
 		if (p != buf) {
-		    if (!usock)
+		    if (!usock && !udpserver)
 			syslog(pri, "%s", buf);
 		    else
 			mysyslog(LogSock, logflags, pri, tag, buf);
@@ -295,7 +295,7 @@
 		    if (len > 0 && buf[len - 1] == '\n')
 			    buf[len - 1] = '\0';
 
-		    if (!usock)
+		    if (!usock && !udpserver)
 			syslog(pri, "%s", buf);
 		    else
 			mysyslog(LogSock, logflags, pri, tag, buf);

Reply via email to