Fix signal handler from getting stuck in an endless loop

The signal handler for SIGINT/TERM/QUIT and, importantly, SIGPIPE tries
to write an informational message to stderr. When however stderr is
redirected to a closed pipe, this will cause (another) SIGPIPE, and in
turn the signal handler will get called again, and again and again.

Since we intend to exit rtl_fm anyways, we can just ignore this signal.
This commit is contained in:
Tobias Girstmair
2022-11-18 16:20:14 +01:00
committed by Steve Markgraf
parent 5e73f90f1d
commit 142325a93c
6 changed files with 6 additions and 0 deletions

View File

@ -144,6 +144,7 @@ sighandler(int signum)
#else
static void sighandler(int signum)
{
signal(SIGPIPE, SIG_IGN);
fprintf(stderr, "Signal caught, exiting!\n");
rtlsdr_cancel_async(dev);
do_exit = 1;