Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] uuidd: improve socket activation error messaging
@ 2015-09-05 18:56 Sami Kerola
  2015-10-02 10:38 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Sami Kerola @ 2015-09-05 18:56 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Tell more exactly what is wrong and how, and give hint how to recover
when possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/uuidd.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 1cbdeef..9d6d08d 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -360,9 +360,17 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
 
 #ifdef HAVE_LIBSYSTEMD
 	if (uuidd_cxt->no_sock) {
-		if (sd_listen_fds(0) != 1)
-			errx(EXIT_FAILURE, _("no or too many file descriptors received"));
-
+		const int ret = sd_listen_fds(0);
+
+		if (ret < 0) {
+			errno = ret * -1;
+			err(EXIT_FAILURE, _("sd_listen_fds() failed"));
+		} else if (ret == 0)
+			errx(EXIT_FAILURE,
+			     _("no file descriptors received, check systemctl status uuidd.socket"));
+		else if (1 < ret)
+			errx(EXIT_FAILURE,
+			     _("too many file descriptors received, check uuidd.socket"));
 		s = SD_LISTEN_FDS_START + 0;
 	}
 #endif
-- 
2.5.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] uuidd: improve socket activation error messaging
  2015-09-05 18:56 [PATCH] uuidd: improve socket activation error messaging Sami Kerola
@ 2015-10-02 10:38 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-10-02 10:38 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sat, Sep 05, 2015 at 07:56:36PM +0100, Sami Kerola wrote:
>  misc-utils/uuidd.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-02 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-05 18:56 [PATCH] uuidd: improve socket activation error messaging Sami Kerola
2015-10-02 10:38 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox