Hello Sami Kerola.

On Fri, Jul 03, 2015 at 08:30:33PM +0100, Sami Kerola wrote:
> Hi Andreas,
> 
> Fancy trying if the attached change if the logger(1) would do what is 
> expected?

For my very limited simple testcase (just running "logger" in a chroot
when /dev(/log) is not available) the behaviour with your patch applied
now seems to be the same as with util-linux v2.25.2 logger.

Robie Basak, could you please try if Samis patch resolves the issue
you where experiencing? See attachement.

Regards,
Andreas Henriksson
>From 43dcc79e8d5394c255e4484a26b3ef0aca478102 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerol...@iki.fi>
Date: Fri, 3 Jul 2015 19:57:13 +0100
Subject: [PATCH] logger: do not exit when socket errors are not enforced
Organization: CloudFlare

The libc openlog(3) does not have error detection whether unix socket
could be opened.  As a side effect that made it possible to use logger
even if syslogd was not running.  Of course user message in these cases
were lost.  This change makes the logger do behave similar way again, so
that sysvinit scripts can successfully pipe messages to logger when ever.

Addresses: https://bugs.debian.org/787864
Addresses: https://bugs.debian.org/790875
Reported-by: Andreas Beckmann <a...@debian.org>
Reported-by: Robie Basak <robie.ba...@ubuntu.com>
Reported-by: Andreas Henriksson <andr...@fatal.se>
Signed-off-by: Sami Kerola <kerol...@iki.fi>
---
 misc-utils/logger.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 8908dfc..273303d 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -242,9 +242,9 @@ static int unix_socket(struct logger_ctl *ctl, const char *path, const int socke
 		if (ctl->unix_socket_errors)
 			err(EXIT_FAILURE, _("socket %s"), path);
 		else
-			/* See --socket-errors manual page entry for
-			 * explanation of this strange exit.  */
-			exit(EXIT_SUCCESS);
+			/* openlog(3) compatibility, socket errors are
+			 * not reported, but ignored silently */
+			ctl->noact = 1;
 	}
 	return fd;
 }
-- 
2.4.5

Reply via email to