aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.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/player.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 '')
-rw-r--r--src/player.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/player.c b/src/player.c
index 417b76f69..9376d01b3 100644
--- a/src/player.c
+++ b/src/player.c
@@ -46,13 +46,15 @@
#include <fcntl.h>
volatile int player_pid = 0;
-volatile int player_termSent = 0;
+
+void clearPlayerPid() {
+ player_pid = 0;
+}
void resetPlayer() {
int pid;
- player_pid = 0;
- player_termSent = 0;
+ clearPlayerPid();
getPlayerData()->playerControl.stop = 0;
getPlayerData()->playerControl.play = 0;
getPlayerData()->playerControl.pause = 0;
@@ -97,6 +99,8 @@ int playerInit() {
PlayerControl * pc = &(getPlayerData()->playerControl);
struct sigaction sa;
+ clearUpdatePid();
+
unblockSignals();
sa.sa_flags = 0;
@@ -104,11 +108,11 @@ int playerInit() {
finishSigHandlers();
sa.sa_handler = decodeSigHandler;
- sigaction(SIGCHLD,&sa,NULL);
- sigaction(SIGTERM,&sa,NULL);
- sigaction(SIGINT,&sa,NULL);
+ while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
+ while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
+ while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
- close(listenSocket);
+ while(close(listenSocket)<0 && errno==EINTR);
freeAllInterfaces();
closeMp3Directory();
finishPlaylist();