aboutsummaryrefslogtreecommitdiffstats
path: root/src/sig_handlers.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-03 14:29:37 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-03 14:29:37 +0000
commitc5ce5f3c01af95093aea122a3be2b40288ab94e4 (patch)
tree074b12683d9f0867187023b1ba9f3ae34c69e8d4 /src/sig_handlers.c
parent118acc5875420133061deeaf9682cc65c8ce876e (diff)
downloadmpd-c5ce5f3c01af95093aea122a3be2b40288ab94e4.tar.gz
mpd-c5ce5f3c01af95093aea122a3be2b40288ab94e4.tar.xz
mpd-c5ce5f3c01af95093aea122a3be2b40288ab94e4.zip
new setSigHandlersForDecoder() function, and be sure player/decode processes ignore SIGHUP signals
git-svn-id: https://svn.musicpd.org/mpd/trunk@2492 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/sig_handlers.c')
-rw-r--r--src/sig_handlers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sig_handlers.c b/src/sig_handlers.c
index a3ac478cb..4ab5163bf 100644
--- a/src/sig_handlers.c
+++ b/src/sig_handlers.c
@@ -25,6 +25,7 @@
#include "signal_check.h"
#include "log.h"
#include "player.h"
+#include "decode.h"
#include <signal.h>
#include <sys/types.h>
@@ -89,6 +90,21 @@ void finishSigHandlers() {
signal_unhandle(SIGHUP);
}
+void setSigHandlersForDecoder() {
+ struct sigaction sa;
+
+ finishSigHandlers();
+
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_handler = SIG_IGN;
+ while(sigaction(SIGHUP,&sa,NULL)<0 && errno==EINTR);
+ sa.sa_handler = decodeSigHandler;
+ while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
+ while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
+ while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
+}
+
void ignoreSignals() {
struct sigaction sa;