From: Rafał Długołęcki Date: Sat, 21 Jun 2014 05:38:46 +0000 (+0200) Subject: Replace SIGQUIT with SIGTERM. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=926f412c0c3d5f071956c79084f5e9eea823f91c;p=wsti_so.git Replace SIGQUIT with SIGTERM. --- diff --git a/src/process1.c b/src/process1.c index ad4b911..fbee7c9 100644 --- a/src/process1.c +++ b/src/process1.c @@ -28,8 +28,8 @@ void sig_handler(int signo) if (signo == SIGUSR1) { fprintf(stderr, "[%s] Received SIGUSR1!\n", "process1"); } - else if (signo == SIGQUIT) { - fprintf(stderr, "[%s] Received SIGQUIT!\n", "process1"); + else if (signo == SIGTERM) { + fprintf(stderr, "[%s] Received SIGTERM!\n", "process1"); fprintf(stderr, "[%s] > Releasing resources\n", "process1"); close(write_pipe); unlink(write_pipe); @@ -80,8 +80,8 @@ int main(void) { if (signal(SIGUSR1, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGUSR1\n"); } - if (signal(SIGQUIT, sig_handler) == SIG_ERR) { - fprintf(stderr, "can't catch SIGQUIT\n"); + if (signal(SIGTERM, sig_handler) == SIG_ERR) { + fprintf(stderr, "can't catch SIGTERM\n"); } if (signal(SIGINT, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGINT\n"); diff --git a/src/process2.c b/src/process2.c index 2b9a6f3..75dacfd 100644 --- a/src/process2.c +++ b/src/process2.c @@ -31,8 +31,8 @@ void sig_handler(int signo) if (signo == SIGUSR1) { fprintf(stderr, "[%s] Received SIGUSR1!\n", "process2"); } - else if (signo == SIGQUIT) { - fprintf(stderr, "[%s] Received SIGQUIT!\n", "process2"); + else if (signo == SIGTERM) { + fprintf(stderr, "[%s] Received SIGTERM!\n", "process2"); fprintf(stderr, "[%s] > Releasing resources\n", "process2"); close(read_descriptor); close(write_descriptor); @@ -82,8 +82,8 @@ int main(void) { if (signal(SIGUSR1, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGUSR1\n"); } - if (signal(SIGQUIT, sig_handler) == SIG_ERR) { - fprintf(stderr, "can't catch SIGQUIT\n"); + if (signal(SIGTERM, sig_handler) == SIG_ERR) { + fprintf(stderr, "can't catch SIGTERM\n"); } if (signal(SIGINT, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGINT\n"); diff --git a/src/process3.c b/src/process3.c index e75a4fb..de70b8d 100644 --- a/src/process3.c +++ b/src/process3.c @@ -23,8 +23,8 @@ void sig_handler(int signo) if (signo == SIGUSR1) { fprintf(stderr, "[%s] Received SIGUSR1!\n", "process3"); } - else if (signo == SIGQUIT) { - fprintf(stderr, "[%s] Received SIGQUIT!\n", "process3"); + else if (signo == SIGTERM) { + fprintf(stderr, "[%s] Received SIGTERM!\n", "process3"); fprintf(stderr, "[%s] > Releasing resources\n", "process3"); close(read_descriptor); exit(0); @@ -60,8 +60,8 @@ int main(void) { if (signal(SIGUSR1, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGUSR1\n"); } - if (signal(SIGQUIT, sig_handler) == SIG_ERR) { - fprintf(stderr, "can't catch SIGQUIT\n"); + if (signal(SIGTERM, sig_handler) == SIG_ERR) { + fprintf(stderr, "can't catch SIGTERM\n"); } if (signal(SIGINT, sig_handler) == SIG_ERR) { fprintf(stderr, "can't catch SIGINT\n");