ok, fix some bug due to a child process dieing before the parent can
even assign pid, thus we need to block CHLD signal around fork(); git-svn-id: https://svn.musicpd.org/mpd/trunk@694 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "volume.h"
|
||||
#include "playerData.h"
|
||||
#include "permission.h"
|
||||
#include "sig_handlers.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
@@ -88,11 +89,14 @@ void player_sigChldHandler(int pid, int status) {
|
||||
}
|
||||
|
||||
int playerInit() {
|
||||
blockSignals();
|
||||
player_pid = fork();
|
||||
|
||||
if(player_pid==0) {
|
||||
PlayerControl * pc = &(getPlayerData()->playerControl);
|
||||
struct sigaction sa;
|
||||
|
||||
unblockSignals();
|
||||
|
||||
sa.sa_flags = 0;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
@@ -136,11 +140,13 @@ int playerInit() {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else if(player_pid<0) {
|
||||
unblockSignals();
|
||||
ERROR("player Problems fork()'ing\n");
|
||||
player_pid = 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
unblockSignals();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user