blob: 045fea89c935cb7f4c26aa04e423c2ebd0ad419f [file] [log] [blame]
From f1b66bebba6f24c6fad14a524d637b4574f7fe52 Mon Sep 17 00:00:00 2001
From: Avery Pennarun <apenwarr@gmail.com>
Date: Wed, 11 Apr 2012 12:09:50 -0400
Subject: [PATCH] logger.c: use '-u /dev/log -d' by default.
This works around a bug in uClibc where openlog() opens /dev/log using
a nonblocking socket, and thus can silently throw away log messages if the
buffer overfills. glibc's openlog/syslog use blocking sockets as they
should, and that's what programs expect.
Anyway, logger.c has a mode where it just connects to the syslog socket by
itself if you provide -u. So let's just pretend the user *always* provides
-u by default. (Providing it explicitly will still override its value.)
---
misc-utils/logger.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index a63476f..a4af9ba 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -75,6 +75,7 @@ myopenlog(const char *sock) {
s_addr.sun_family = AF_UNIX;
(void)strcpy(s_addr.sun_path, sock);
+ if (strcmp(sock, "/dev/log") == 0) optd = 1;
if ((fd = socket(AF_UNIX, optd ? SOCK_DGRAM : SOCK_STREAM, 0)) == -1)
err(EXIT_FAILURE, _("socket %s"), sock);
@@ -165,7 +166,7 @@ int
main(int argc, char **argv) {
int ch, logflags, pri;
char *tag, buf[1024];
- char *usock = NULL;
+ char *usock = "/dev/log";
char *udpserver = NULL;
int LogSock = -1;
long tmpport;