Commit 7e9057d0 authored by rdoost's avatar rdoost

added SIGPIPE to the list of signals to be handled by main thread

parent e0156a33
...@@ -68,6 +68,7 @@ int signal_mask(void) ...@@ -68,6 +68,7 @@ int signal_mask(void)
sigaddset (&set, SIGABRT); sigaddset (&set, SIGABRT);
sigaddset (&set, SIGSEGV); sigaddset (&set, SIGSEGV);
sigaddset (&set, SIGINT); sigaddset (&set, SIGINT);
sigaddset (&set, SIGPIPE);
if (sigprocmask(SIG_BLOCK, &set, NULL) < 0) { if (sigprocmask(SIG_BLOCK, &set, NULL) < 0) {
perror ("sigprocmask"); perror ("sigprocmask");
...@@ -89,12 +90,13 @@ int signal_handle(int *end) ...@@ -89,12 +90,13 @@ int signal_handle(int *end)
sigaddset (&set, SIGABRT); sigaddset (&set, SIGABRT);
sigaddset (&set, SIGSEGV); sigaddset (&set, SIGSEGV);
sigaddset (&set, SIGINT); sigaddset (&set, SIGINT);
sigaddset (&set, SIGPIPE);
/*
if (sigprocmask(SIG_BLOCK, &set, NULL) < 0) { if (sigprocmask(SIG_BLOCK, &set, NULL) < 0) {
perror ("sigprocmask"); perror ("sigprocmask");
return -1; return -1;
} }
*/
/* Block till a signal is received. /* Block till a signal is received.
* NOTE: The signals defined by set are required to be blocked at the time * NOTE: The signals defined by set are required to be blocked at the time
* of the call to sigwait() otherwise sigwait() is not successful. * of the call to sigwait() otherwise sigwait() is not successful.
...@@ -125,12 +127,13 @@ int signal_handle(int *end) ...@@ -125,12 +127,13 @@ int signal_handle(int *end)
backtrace_handle_signal(&info); backtrace_handle_signal(&info);
break; break;
case SIGPIPE:
case SIGINT: case SIGINT:
printf("Received SIGINT\n"); printf("Received SIGINT\n");
itti_send_terminate_message(TASK_UNKNOWN); itti_send_terminate_message(TASK_UNKNOWN);
*end = 1; *end = 1;
break; break;
default: default:
SIG_ERROR("Received unknown signal %d\n", info.si_signo); SIG_ERROR("Received unknown signal %d\n", info.si_signo);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment