[hackers] [quark] Use strsignal() for signal-logging || FRIGN

From: <git_AT_suckless.org>
Date: Thu, 07 Aug 2014 16:27:56 +0200

commit 1e23378afd8fd19707cd880a638a8112801bf9cc
Author: FRIGN <dev_AT_frign.de>
Date: Thu Aug 7 16:28:01 2014 +0200

    Use strsignal() for signal-logging
    
    This also makes clearer what happens when you do not know the
    abbreviations well.

diff --git a/quark.c b/quark.c
index 574fb9b..0a39e91 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -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:
_AT_@ -474,7 +466,7 @@ sighandler(int sig) {
         case SIGQUIT:
         case SIGABRT:
         case SIGTERM:
- logerrmsg("received signal %s, closing down
", signame[sig] ? signame[sig] : "");
+ logerrmsg("received signal: %s, closing down
", strsignal(sig));
                 close(fd);
                 running = 0;
                 break;
Received on Thu Aug 07 2014 - 16:27:56 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 07 2014 - 16:36:13 CEST