Replace SIGQUIT with SIGTERM.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 21 Jun 2014 05:38:46 +0000 (07:38 +0200)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 21 Jun 2014 05:38:46 +0000 (07:38 +0200)
src/process1.c
src/process2.c
src/process3.c

index ad4b9111984c64b4079a78e32a41f912fcf965de..fbee7c9f22ad04dbabd5a456a60cae3cfb988a7e 100644 (file)
@@ -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");
index 2b9a6f31feaf9c50d4d0135d08e1e7427cdf0f7b..75dacfde993ab2fa3f29357ac1fa335896dd827a 100644 (file)
@@ -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");
index e75a4fb610d66bae33e895d8271178a8280fe1e7..de70b8d372b43f807c595d5ce8298c37253a7556 100644 (file)
@@ -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");