From: Ray Strode Date: Fri, 17 Sep 2010 01:10:01 +0000 (-0400) Subject: utils: Improve debug spew in ply_create_daemon X-Git-Tag: 0.8.4~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e6bc5ac63f996f968e9bec1647f8cbabd40098f;p=thirdparty%2Fplymouth.git utils: Improve debug spew in ply_create_daemon Right now if plymouthd dies while daemonizing, we show a horrible error message on the console: could not read byte from child: Success This commit mops that up, so we give a little clue why plymouthd's child process died in its infancy. --- diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index ac5a5c14..a65c469a 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -846,7 +847,20 @@ ply_create_daemon (const char *pid_file) if (!ply_read (receiver_fd, &byte, sizeof (uint8_t))) { - ply_error ("could not read byte from child: %m"); + int status; + + if (waitpid (pid, &status, WNOHANG) <= 0) + { + ply_error ("failed to read status from child immediately after starting to daemonize"); + } + else if (WIFEXITED (status)) + { + ply_error ("unexpectedly exited with status %d immediately after starting to daemonize", (int) WEXITSTATUS (status)); + } + else if (WIFSIGNALED (status)) + { + ply_error ("unexpectedly died from signal %s immediately after starting to daemonize", strsignal (WTERMSIG (status))); + } _exit (1); }