diff options
Diffstat (limited to 'src/player.c')
-rw-r--r-- | src/player.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/player.c b/src/player.c index 4efe55679..63ee4f062 100644 --- a/src/player.c +++ b/src/player.c @@ -66,29 +66,24 @@ void resetPlayer() { getPlayerData()->playerControl.decode_pid = 0; } -void player_sigHandler(int signal) { - if(signal==SIGCHLD) { - int status; - int pid = wait3(&status,WNOHANG,NULL); - if(player_pid==pid) { - if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) { - ERROR("player process died from a " - "non-TERM signal: %i\n", - WTERMSIG(status)); - } - resetPlayer(); +void player_sigChldHandler(int pid, int status) { + if(player_pid==pid) { + if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) { + ERROR("player process died from a " + "non-TERM signal: %i\n", + WTERMSIG(status)); } - else if(pid==getPlayerData()->playerControl.decode_pid && - player_pid<=0) - { - if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) { - ERROR("(caught by master parent) " - "decode process died from a " - "non-TERM signal: %i\n", - WTERMSIG(status)); - } - getPlayerData()->playerControl.decode_pid = 0; + resetPlayer(); + } + else if(pid==getPlayerData()->playerControl.decode_pid && player_pid<=0) + { + if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) { + ERROR("(caught by master parent) " + "decode process died from a " + "non-TERM signal: %i\n", + WTERMSIG(status)); } + getPlayerData()->playerControl.decode_pid = 0; } } |