From 1e0d5bba7120375ef4890b2a22267969bbfff1be Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 8 Mar 2023 18:05:54 +0200 Subject: [PATCH] wayland: Prevent leaking --wayland-fd and --xwayland-fd to child processes fcntl() expects FD_CLOEXEC instead of conventional O_CLOEXEC. --- src/main_wayland.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index e8a28ddfe5..fa95435c10 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -505,7 +505,7 @@ int main(int argc, char *argv[]) int fd = parser.value(waylandSocketFdOption).toInt(&ok); if (ok) { // make sure we don't leak this FD to children - fcntl(fd, F_SETFD, O_CLOEXEC); + fcntl(fd, F_SETFD, FD_CLOEXEC); server->display()->addSocketFileDescriptor(fd, socketName); } else { std::cerr << "FATAL ERROR: could not parse socket FD" << std::endl; @@ -589,7 +589,7 @@ int main(int argc, char *argv[]) int fd = fdString.toInt(&ok); if (ok) { // make sure we don't leak this FD to children - fcntl(fd, F_SETFD, O_CLOEXEC); + fcntl(fd, F_SETFD, FD_CLOEXEC); a.addXwaylandSocketFileDescriptor(fd); } }