From a3d7199bea675f3d4691199874960d1804c51c6e Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 7 Jul 2022 14:30:17 +0300 Subject: [PATCH] xwayland: use pipe2() We are already using pipe2() in many places, even in libweston, so let's simplify the code here as well - not to mention avoid a theoretical race. Signed-off-by: Pekka Paalanen --- compositor/xwayland.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/compositor/xwayland.c b/compositor/xwayland.c index 92816379..49841aef 100644 --- a/compositor/xwayland.c +++ b/compositor/xwayland.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "compositor/weston.h" @@ -154,21 +155,10 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd } fdstr_update_str1(&x11_wm_socket); - if (pipe(display_pipe.fds) < 0) { + if (pipe2(display_pipe.fds, O_CLOEXEC) < 0) { weston_log("pipe creation for displayfd failed\n"); return 1; } - - if (os_fd_set_cloexec(display_pipe.fds[0]) != 0) { - weston_log("failed setting compositor end of displayfd as cloexec\n"); - return 1; - } - - if (os_fd_set_cloexec(display_pipe.fds[1]) != 0) { - weston_log("failed setting Xwayland end of displayfd as cloexec\n"); - return 1; - } - fdstr_update_str1(&display_pipe); fdstr_set_fd1(&x11_abstract_socket, abstract_fd);