fix xmms spawn bug

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@224 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-09-20 19:37:28 +00:00
parent 42bba491a8
commit bb31eda806
2 changed files with 7 additions and 11 deletions

View file

@ -1,9 +1,5 @@
*** $Id$ *** *** $Id$ ***
*** 0.5 ***
- xmms segfault when daemon not executable
- update modinfo
*** 0.6 **** *** 0.6 ****
- per-channel volume - per-channel volume
- unix socket directories include user name - unix socket directories include user name

View file

@ -388,7 +388,6 @@ static int default_server_is_running(void) {
return 1; return 1;
} }
static int context_connect_spawn(struct pa_context *c, const struct pa_spawn_api *api) { static int context_connect_spawn(struct pa_context *c, const struct pa_spawn_api *api) {
pid_t pid; pid_t pid;
int status, r; int status, r;
@ -416,26 +415,27 @@ static int context_connect_spawn(struct pa_context *c, const struct pa_spawn_api
goto fail; goto fail;
} else if (!pid) { } else if (!pid) {
/* Child */ /* Child */
char t[128]; char t[128];
const char *state = NULL; const char *state = NULL;
#define MAX_ARGS 64 #define MAX_ARGS 64
char *argv[MAX_ARGS+1]; char *argv[MAX_ARGS+1];
int n = 0; int n;
close(fds[0]); close(fds[0]);
if (api && api->atfork) if (api && api->atfork)
api->atfork(); api->atfork();
snprintf(t, sizeof(t), "%s=1", ENV_AUTOSPAWNED); /* Setup argv */
putenv(t);
n = 0;
argv[n++] = c->conf->daemon_binary; argv[n++] = c->conf->daemon_binary;
argv[n++] = "--daemonize=yes"; argv[n++] = "--daemonize=yes";
snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]); snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]);
argv[n++] = t; argv[n++] = strdup(t);
while (n < MAX_ARGS) { while (n < MAX_ARGS) {
char *a; char *a;
@ -449,7 +449,7 @@ static int context_connect_spawn(struct pa_context *c, const struct pa_spawn_api
argv[n++] = NULL; argv[n++] = NULL;
execv(argv[0], argv); execv(argv[0], argv);
exit(1); _exit(1);
} }
/* Parent */ /* Parent */