use termination function on SIGPIPE (write to closed socket) too
This commit is contained in:
@@ -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 */
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user