xwayland: use execv()
Constructing argv before-hand is a little easier to look at, but this is mostly just anticipating more changes to how Weston spawns processes in general. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
a3d7199bea
commit
d1b01ffb9a
+14
-10
@@ -170,6 +170,18 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||||||
str_printf(&exec_failure_msg,
|
str_printf(&exec_failure_msg,
|
||||||
"Error: executing Xwayland as '%s' failed.\n", xserver);
|
"Error: executing Xwayland as '%s' failed.\n", xserver);
|
||||||
|
|
||||||
|
const char *const argv[] = {
|
||||||
|
xserver,
|
||||||
|
display,
|
||||||
|
"-rootless",
|
||||||
|
LISTEN_STR, x11_abstract_socket.str1,
|
||||||
|
LISTEN_STR, x11_unix_socket.str1,
|
||||||
|
"-displayfd", display_pipe.str1,
|
||||||
|
"-wm", x11_wm_socket.str1,
|
||||||
|
"-terminate",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
switch (pid) {
|
switch (pid) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -185,21 +197,13 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||||||
|
|
||||||
setenv("WAYLAND_SOCKET", wayland_socket.str1, 1);
|
setenv("WAYLAND_SOCKET", wayland_socket.str1, 1);
|
||||||
|
|
||||||
if (execl(xserver,
|
if (execv(xserver, (char *const *)argv) < 0) {
|
||||||
xserver,
|
|
||||||
display,
|
|
||||||
"-rootless",
|
|
||||||
LISTEN_STR, x11_abstract_socket.str1,
|
|
||||||
LISTEN_STR, x11_unix_socket.str1,
|
|
||||||
"-displayfd", display_pipe.str1,
|
|
||||||
"-wm", x11_wm_socket.str1,
|
|
||||||
"-terminate",
|
|
||||||
NULL) < 0) {
|
|
||||||
if (exec_failure_msg) {
|
if (exec_failure_msg) {
|
||||||
write(STDERR_FILENO, exec_failure_msg,
|
write(STDERR_FILENO, exec_failure_msg,
|
||||||
strlen(exec_failure_msg));
|
strlen(exec_failure_msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user