mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-11-10 04:37:37 +01:00
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:
parent
5e73f90f1d
commit
142325a93c
@ -123,6 +123,7 @@ sighandler(int signum)
|
||||
#else
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fprintf(stderr, "Signal caught, exiting!\n");
|
||||
do_exit = 1;
|
||||
rtlsdr_cancel_async(dev);
|
||||
|
@ -246,6 +246,7 @@ sighandler(int signum)
|
||||
#else
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fprintf(stderr, "Signal caught, exiting!\n");
|
||||
do_exit = 1;
|
||||
rtlsdr_cancel_async(dongle.dev);
|
||||
|
@ -195,6 +195,7 @@ sighandler(int signum)
|
||||
#else
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
do_exit++;
|
||||
multi_bail();
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ sighandler(int signum)
|
||||
#else
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fprintf(stderr, "Signal caught, exiting!\n");
|
||||
do_exit = 1;
|
||||
rtlsdr_cancel_async(dev);
|
||||
|
@ -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;
|
||||
|
@ -115,6 +115,7 @@ sighandler(int signum)
|
||||
#else
|
||||
static void sighandler(int signum)
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fprintf(stderr, "Signal caught, exiting!\n");
|
||||
do_exit = 1;
|
||||
rtlsdr_cancel_async(dev);
|
||||
|
Loading…
Reference in New Issue
Block a user