From: Takashi Iwai Date: Wed, 29 Apr 2015 16:01:58 +0000 (+0200) Subject: aplay: Fix uninterruptible aplay X-Git-Tag: v1.1.0~30 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=46b60827568ca4aad15eeacbc9dcf8597986ca8e;p=alsa-utils.git aplay: Fix uninterruptible aplay When aplay is invoked to play from stdin, it can't be terminated by normal signals like SIGTERM or SIGINT. It's because our signal handler tries to trap as much as possible while the stalling point is not in the PCM loop but rather the file I/O. For fixing this, leave our signal handler once when a signal is received and snd_pcm_abort() is called. At the next hit, it shall be handled normally. Signed-off-by: Takashi Iwai --- diff --git a/aplay/aplay.c b/aplay/aplay.c index dfa1a0a..459f7dd 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -399,7 +399,7 @@ static void signal_handler(int sig) handle = NULL; prg_exit(EXIT_FAILURE); } - signal(sig, signal_handler); + signal(sig, SIG_DFL); } /* call on SIGUSR1 signal. */