/*
* UCW Library -- Formatting of Process Exit Status
*
- * (c) 2004 Martin Mares <mj@ucw.cz>
+ * (c) 2004--2012 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
#include <ucw/lib.h>
#include <ucw/process.h>
+#include <ucw/signames.h>
#include <stdio.h>
#include <sys/wait.h>
}
}
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;
/* exitstatus.c */
-#define EXIT_STATUS_MSG_SIZE 32
+#define EXIT_STATUS_MSG_SIZE 64
int format_exit_status(char *msg, int stat);
/* runcmd.c */