|
|
@ -408,7 +408,7 @@ weston_client_launch(struct weston_compositor *compositor, |
|
|
|
{ |
|
|
|
{ |
|
|
|
int sv[2]; |
|
|
|
int sv[2]; |
|
|
|
pid_t pid; |
|
|
|
pid_t pid; |
|
|
|
struct wl_client *client; |
|
|
|
struct wl_client *client = NULL; |
|
|
|
|
|
|
|
|
|
|
|
weston_log("launching '%s'\n", path); |
|
|
|
weston_log("launching '%s'\n", path); |
|
|
|
|
|
|
|
|
|
|
@ -420,16 +420,8 @@ weston_client_launch(struct weston_compositor *compositor, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pid = fork(); |
|
|
|
pid = fork(); |
|
|
|
if (pid == -1) { |
|
|
|
switch (pid) { |
|
|
|
close(sv[0]); |
|
|
|
case 0: |
|
|
|
close(sv[1]); |
|
|
|
|
|
|
|
weston_log("weston_client_launch: " |
|
|
|
|
|
|
|
"fork failed while launching '%s': %s\n", path, |
|
|
|
|
|
|
|
strerror(errno)); |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pid == 0) { |
|
|
|
|
|
|
|
/* Put the client in a new session so it won't catch signals
|
|
|
|
/* Put the client in a new session so it won't catch signals
|
|
|
|
* intended for the parent. Sharing a session can be |
|
|
|
* intended for the parent. Sharing a session can be |
|
|
|
* confusing when launching weston under gdb, as the ctrl-c |
|
|
|
* confusing when launching weston under gdb, as the ctrl-c |
|
|
@ -439,10 +431,9 @@ weston_client_launch(struct weston_compositor *compositor, |
|
|
|
setsid(); |
|
|
|
setsid(); |
|
|
|
child_client_exec(sv[1], path); |
|
|
|
child_client_exec(sv[1], path); |
|
|
|
_exit(-1); |
|
|
|
_exit(-1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
close(sv[1]); |
|
|
|
close(sv[1]); |
|
|
|
|
|
|
|
|
|
|
|
client = wl_client_create(compositor->wl_display, sv[0]); |
|
|
|
client = wl_client_create(compositor->wl_display, sv[0]); |
|
|
|
if (!client) { |
|
|
|
if (!client) { |
|
|
|
close(sv[0]); |
|
|
|
close(sv[0]); |
|
|
@ -455,6 +446,16 @@ weston_client_launch(struct weston_compositor *compositor, |
|
|
|
proc->pid = pid; |
|
|
|
proc->pid = pid; |
|
|
|
proc->cleanup = cleanup; |
|
|
|
proc->cleanup = cleanup; |
|
|
|
wet_watch_process(compositor, proc); |
|
|
|
wet_watch_process(compositor, proc); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case -1: |
|
|
|
|
|
|
|
close(sv[0]); |
|
|
|
|
|
|
|
close(sv[1]); |
|
|
|
|
|
|
|
weston_log("weston_client_launch: " |
|
|
|
|
|
|
|
"fork failed while launching '%s': %s\n", path, |
|
|
|
|
|
|
|
strerror(errno)); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return client; |
|
|
|
return client; |
|
|
|
} |
|
|
|
} |
|
|
|