void sigpipe_h(int){ //DBG; piped++; } ... struct sigaction sighup,sigpipe; sigpipe.sa_handler=sigpipe_h; sighup.sa_flags=SA_NODEFER; sigaction(SIGPIPE,&sigpipe,NULL); Program received signal SIGPIPE, Broken pipe. 0xffffe410 in __kernel_vsyscall () (gdb) cont Continuing. Program received signal SIGSEGV, Segmentation fault. 0xb7d7428c in ?? () from /lib/tls/i686/cmov/libc.so.6 (gdb) bt #0 0xb7d7428c in ?? () from /lib/tls/i686/cmov/libc.so.6 #1 0x0000000d in ?? () #2 0x00000033 in ?? () #3 0x00000000 in ?? () (gdb) normal backtrace right after the sigpipe and when in signal handler