Use strsignal() for signal-logging
This also makes clearer what happens when you do not know the abbreviations well.
This commit is contained in:
parent
abec80e6ce
commit
1e23378afd
1 changed files with 1 additions and 9 deletions
10
quark.c
10
quark.c
|
@ -459,14 +459,6 @@ serve(int fd) {
|
||||||
|
|
||||||
void
|
void
|
||||||
sighandler(int sig) {
|
sighandler(int sig) {
|
||||||
static const char *signame[64] = {
|
|
||||||
[SIGHUP] = "SIGHUP",
|
|
||||||
[SIGINT] = "SIGINT",
|
|
||||||
[SIGQUIT] = "SIGQUIT",
|
|
||||||
[SIGABRT] = "SIGABRT",
|
|
||||||
[SIGTERM] = "SIGTERM",
|
|
||||||
[SIGCHLD] = "SIGCHLD"
|
|
||||||
};
|
|
||||||
switch(sig) {
|
switch(sig) {
|
||||||
default: break;
|
default: break;
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
|
@ -474,7 +466,7 @@ sighandler(int sig) {
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
logerrmsg("received signal %s, closing down\n", signame[sig] ? signame[sig] : "");
|
logerrmsg("received signal: %s, closing down\n", strsignal(sig));
|
||||||
close(fd);
|
close(fd);
|
||||||
running = 0;
|
running = 0;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue