Use strsignal() for signal-logging

This also makes clearer what happens when you do not know the
abbreviations well.
This commit is contained in:
FRIGN 2014-08-07 16:28:01 +02:00
parent abec80e6ce
commit 1e23378afd

10
quark.c
View file

@ -459,14 +459,6 @@ serve(int fd) {
void
sighandler(int sig) {
static const char *signame[64] = {
[SIGHUP] = "SIGHUP",
[SIGINT] = "SIGINT",
[SIGQUIT] = "SIGQUIT",
[SIGABRT] = "SIGABRT",
[SIGTERM] = "SIGTERM",
[SIGCHLD] = "SIGCHLD"
};
switch(sig) {
default: break;
case SIGHUP:
@ -474,7 +466,7 @@ sighandler(int sig) {
case SIGQUIT:
case SIGABRT:
case SIGTERM:
logerrmsg("received signal %s, closing down\n", signame[sig] ? signame[sig] : "");
logerrmsg("received signal: %s, closing down\n", strsignal(sig));
close(fd);
running = 0;
break;