From 177c0651b0e90276cf60200b73c5785555b811e6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 18 Jul 2012 12:14:53 +0200 Subject: [PATCH] Process: Let format_exit_status() name the lethal signal --- ucw/exitstatus.c | 9 +++++++-- ucw/process.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ucw/exitstatus.c b/ucw/exitstatus.c index fec5593f..7ce1ff5a 100644 --- a/ucw/exitstatus.c +++ b/ucw/exitstatus.c @@ -1,7 +1,7 @@ /* * UCW Library -- Formatting of Process Exit Status * - * (c) 2004 Martin Mares + * (c) 2004--2012 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -30,7 +31,11 @@ format_exit_status(char *msg, int stat) } } else if (WIFSIGNALED(stat)) - sprintf(msg, "died on signal %d", WTERMSIG(stat)); + { + int sig = WTERMSIG(stat); + const char *sn = sig_number_to_name(sig); + sprintf(msg, "died on signal %d (%s)", sig, (sn ? : "unknown")); + } else sprintf(msg, "died with status %x", stat); return 1; diff --git a/ucw/process.h b/ucw/process.h index 1bbeedac..2c780237 100644 --- a/ucw/process.h +++ b/ucw/process.h @@ -18,7 +18,7 @@ char *getproctitle(void); /* exitstatus.c */ -#define EXIT_STATUS_MSG_SIZE 32 +#define EXIT_STATUS_MSG_SIZE 64 int format_exit_status(char *msg, int stat); /* runcmd.c */ -- 2.39.5