vulkan/wsi/x11: replace dup() with os_dupfd_cloexec()

dup() will leak the new FD into any child process after fork().

Signed-off-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26203>
This commit is contained in:
Simon Ser 2025-02-12 21:01:42 +01:00 committed by Marge Bot
parent e4ff98bacb
commit 26d90674c2

View file

@ -2170,7 +2170,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
if (chain->base.image_info.explicit_sync) {
for (uint32_t i = 0; i < WSI_ES_COUNT; i++) {
image->dri3_syncobj[i] = xcb_generate_id(chain->conn);
int fd = dup(image->base.explicit_sync[i].fd);
int fd = os_dupfd_cloexec(image->base.explicit_sync[i].fd);
if (fd < 0)
goto fail_image;