diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-06-09 02:08:50 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-06-09 02:08:50 +0200 |
commit | 31ed5dc6b1a23f645fd9cc14c0df1642471d1aa2 (patch) | |
tree | a992fbef05cc44f626fa3a2366c7f2abeeca7ec4 /src | |
parent | use readline in dumb-client (diff) | |
download | mds-31ed5dc6b1a23f645fd9cc14c0df1642471d1aa2.tar.gz mds-31ed5dc6b1a23f645fd9cc14c0df1642471d1aa2.tar.bz2 mds-31ed5dc6b1a23f645fd9cc14c0df1642471d1aa2.tar.xz |
put process names in quotes and print exit status and termination signal on crashed processes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-respawn.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mds-respawn.c b/src/mds-respawn.c index 84c4b26..23c07e6 100644 --- a/src/mds-respawn.c +++ b/src/mds-respawn.c @@ -419,7 +419,7 @@ static void joined_with_server(pid_t pid, int status) if (states[i].state == CREMATED) { - eprintf("cremated child process %s exited, ignoring.", commands[i][0]); + eprintf("cremated child process `%s' exited, ignoring.", commands[i][0]); return; } @@ -430,27 +430,32 @@ static void joined_with_server(pid_t pid, int status) if (WIFEXITED(status) ? (WEXITSTATUS(status) == 0) : ((WTERMSIG(status) == SIGTERM) || (WTERMSIG(status) == SIGINT))) { - eprintf("child process %s exited normally, cremating.", commands[i][0]); + eprintf("child process `%s' exited normally, cremating.", commands[i][0]); states[i].state = CREMATED; return; } + if (WIFEXITED(status)) + eprintf("`%s' exited with code %i.", commands[i][0], WEXITSTATUS(status)); + else + eprintf("`%s' died by signal %i.", commands[i][0], WTERMSIG(status)); + if (monotone(&ended) < 0) { perror(*argv); - eprintf("%s died abnormally, burying because we could not read the time.", commands[i][0]); + eprintf("`%s' died abnormally, burying because we could not read the time.", commands[i][0]); states[i].state = DEAD_AND_BURIED; return; } if (ended.tv_sec - states[i].started.tv_sec < interval) { - eprintf("%s died abnormally, burying because it died too fast.", commands[i][0]); + eprintf("`%s' died abnormally, burying because it died too fast.", commands[i][0]); states[i].state = DEAD_AND_BURIED; return; } - eprintf("%s died abnormally, respawning.", commands[i][0]); + eprintf("`%s' died abnormally, respawning.", commands[i][0]); spawn_server(i); } |