From c0f4a7008c967efbf7b8372c45a919f58a51e7a1 Mon Sep 17 00:00:00 2001 From: marschap Date: Fri, 2 May 2008 09:58:58 +0000 Subject: [PATCH] use termination function on SIGPIPE (write to closed socket) too --- clients/lcdexec/lcdexec.c | 1 + clients/lcdproc/main.c | 2 +- clients/lcdvc/lcdvc.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clients/lcdexec/lcdexec.c b/clients/lcdexec/lcdexec.c index 63439ae..0487b8e 100644 --- a/clients/lcdexec/lcdexec.c +++ b/clients/lcdexec/lcdexec.c @@ -161,6 +161,7 @@ int main(int argc, char **argv) sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGTERM, &sa, NULL); // "regular" kill sigaction(SIGHUP, &sa, NULL); // kill -HUP + sigaction(SIGPIPE, &sa, NULL); // write to closed socket sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...] /* setup signal handler for children to avoid zombies */ diff --git a/clients/lcdproc/main.c b/clients/lcdproc/main.c index 68d1ff9..0e4c393 100644 --- a/clients/lcdproc/main.c +++ b/clients/lcdproc/main.c @@ -194,6 +194,7 @@ main(int argc, char **argv) signal(SIGINT, exit_program); // Ctrl-C signal(SIGTERM, exit_program); // "regular" kill signal(SIGHUP, exit_program); // kill -HUP + signal(SIGPIPE, exit_program); // write to closed socket signal(SIGKILL, exit_program); // kill -9 [cannot be trapped; but ...] /* No error output from getopt */ @@ -472,7 +473,6 @@ exit_program(int val) */ eyebox_clear(); #endif - //printf("exit program\n"); Quit = 1; sock_close(sock); mode_close(); diff --git a/clients/lcdvc/lcdvc.c b/clients/lcdvc/lcdvc.c index 7bff7fb..1b0db6a 100644 --- a/clients/lcdvc/lcdvc.c +++ b/clients/lcdvc/lcdvc.c @@ -125,6 +125,7 @@ int main(int argc, char **argv) sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGTERM, &sa, NULL); // "regular" kill sigaction(SIGHUP, &sa, NULL); // kill -HUP + sigaction(SIGPIPE, &sa, NULL); // write to closed socket sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...] main_loop();