diff options
author | Sami Kerola <kerolasa@iki.fi> | 2015-09-05 19:56:36 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2015-10-02 12:38:30 +0200 |
commit | fa8945db4aa0526655655526c3ace8fafaf32f8e (patch) | |
tree | 31151002b6b7617c1135b57f305bf28e99d1ebf3 /misc-utils/uuidd.c | |
parent | 100a43932c5769f54a641ec426fca9ef570d53b0 (diff) | |
download | util-linux-fa8945db4aa0526655655526c3ace8fafaf32f8e.tar.gz |
uuidd: improve socket activation error messaging
Tell more exactly what is wrong and how, and give hint how to recover
when possible.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/uuidd.c')
-rw-r--r-- | misc-utils/uuidd.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c index 1cbdeef20..9d6d08d9f 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 |