use termination function on SIGPIPE (write to closed socket) too

This commit is contained in:
marschap
2008-05-02 09:58:58 +00:00
parent decb627924
commit c0f4a7008c
3 changed files with 3 additions and 1 deletions
+1
View File
@@ -161,6 +161,7 @@ int main(int argc, char **argv)
sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGINT, &sa, NULL); // Ctrl-C
sigaction(SIGTERM, &sa, NULL); // "regular" kill sigaction(SIGTERM, &sa, NULL); // "regular" kill
sigaction(SIGHUP, &sa, NULL); // kill -HUP sigaction(SIGHUP, &sa, NULL); // kill -HUP
sigaction(SIGPIPE, &sa, NULL); // write to closed socket
sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...] sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...]
/* setup signal handler for children to avoid zombies */ /* setup signal handler for children to avoid zombies */
+1 -1
View File
@@ -194,6 +194,7 @@ main(int argc, char **argv)
signal(SIGINT, exit_program); // Ctrl-C signal(SIGINT, exit_program); // Ctrl-C
signal(SIGTERM, exit_program); // "regular" kill signal(SIGTERM, exit_program); // "regular" kill
signal(SIGHUP, exit_program); // kill -HUP signal(SIGHUP, exit_program); // kill -HUP
signal(SIGPIPE, exit_program); // write to closed socket
signal(SIGKILL, exit_program); // kill -9 [cannot be trapped; but ...] signal(SIGKILL, exit_program); // kill -9 [cannot be trapped; but ...]
/* No error output from getopt */ /* No error output from getopt */
@@ -472,7 +473,6 @@ exit_program(int val)
*/ */
eyebox_clear(); eyebox_clear();
#endif #endif
//printf("exit program\n");
Quit = 1; Quit = 1;
sock_close(sock); sock_close(sock);
mode_close(); mode_close();
+1
View File
@@ -125,6 +125,7 @@ int main(int argc, char **argv)
sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGINT, &sa, NULL); // Ctrl-C
sigaction(SIGTERM, &sa, NULL); // "regular" kill sigaction(SIGTERM, &sa, NULL); // "regular" kill
sigaction(SIGHUP, &sa, NULL); // kill -HUP sigaction(SIGHUP, &sa, NULL); // kill -HUP
sigaction(SIGPIPE, &sa, NULL); // write to closed socket
sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...] sigaction(SIGKILL, &sa, NULL); // kill -9 [cannot be trapped; but ...]
main_loop(); main_loop();