Hi I'm programming a threaded socket program, The program may receive a SIGPIPE
signal and will exit, If I catch the signal and ignore it the program will have undefined behavior because I don't know how to handle this as error, How can I catch a signal and notify the current position of the code that it needs to return from a function with error code so the program flow will continue as normal, I want to threat the SIGPIPE
as it is error in read/write syscalls, cause i know how to handle read/write errors when I receive them.
{
signal(SIGPIPE,sig_handler);
}
void sig_handler(int signo)
{
if (signo == SIGPIPE){
printf("hi\n");
}
}