aboutsummaryrefslogtreecommitdiffstats
path: root/src/signal_check.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-13 16:46:11 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-13 16:46:11 +0000
commitacf0e147c25d93d9434bb279ae422cb4e62c1f7e (patch)
treeef923e4cec52fe1739f035d6a29f7f4ffa021c16 /src/signal_check.c
parent00c25b772edae62965b1615125b057f5986d18c2 (diff)
downloadmpd-acf0e147c25d93d9434bb279ae422cb4e62c1f7e.tar.gz
mpd-acf0e147c25d93d9434bb279ae422cb4e62c1f7e.tar.xz
mpd-acf0e147c25d93d9434bb279ae422cb4e62c1f7e.zip
when doing signal functions (like sigaction) make sure it wasn't interrupted by a signal (errno==EINTR)
git-svn-id: https://svn.musicpd.org/mpd/trunk@729 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/signal_check.c')
-rw-r--r--src/signal_check.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/signal_check.c b/src/signal_check.c
index 3926ae7b0..b46344488 100644
--- a/src/signal_check.c
+++ b/src/signal_check.c
@@ -1,5 +1,7 @@
#include "signal_check.h"
+#include <errno.h>
+
volatile sig_atomic_t __caught_signals[NSIG];
static void __signal_handler(int sig)
@@ -12,7 +14,7 @@ static void __set_signal_handler(int sig, void (* handler)(int))
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = handler;
- sigaction(sig, &act, 0);
+ while(sigaction(sig, &act, 0) && errno==EINTR);
}
void signal_handle(int sig)