From b43fee3c83212964240a9ad02cc5190d4cbbf096 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Fri, 14 Mar 2014 00:02:54 +1100 Subject: [PATCH] Don't fprintf() inside signal handler, mark running as volatile. --- darkhttpd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/darkhttpd.c b/darkhttpd.c index c3c35f2..cf37013 100644 --- a/darkhttpd.c +++ b/darkhttpd.c @@ -275,7 +275,7 @@ static int want_chroot = 0, want_daemon = 0, want_accf = 0, static char *server_hdr = NULL; static uint64_t num_requests = 0, total_in = 0, total_out = 0; -static int running = 1; /* signal handler sets this to false */ +static volatile int running = 1; /* signal handler sets this to false */ #define INVALID_UID ((uid_t) -1) #define INVALID_GID ((gid_t) -1) @@ -2446,7 +2446,6 @@ static void pidfile_create(void) { /* Close all sockets and FILEs and exit. */ static void stop_running(int sig) { running = 0; - fprintf(stderr, "\ncaught signal %s, stopping\n", strsignal(sig)); } /* Execution starts here. */