From 02fd869106956c446e01ce7648094d0acef78c31 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 8 Mar 2023 18:14:07 +0200 Subject: [PATCH] xwayland: Prevent potential file descriptor leak --- src/xwayland/selection_source.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xwayland/selection_source.cpp b/src/xwayland/selection_source.cpp index 387959569f..b35d4356a4 100644 --- a/src/xwayland/selection_source.cpp +++ b/src/xwayland/selection_source.cpp @@ -16,6 +16,7 @@ #include "wayland/seat_interface.h" #include "wayland_server.h" +#include #include #include @@ -147,7 +148,7 @@ bool WlSource::checkStartTransfer(xcb_selection_request_event_t *event) } int p[2]; - if (pipe(p) == -1) { + if (pipe2(p, O_CLOEXEC) == -1) { qCWarning(KWIN_XWL) << "Pipe failed. Not sending selection."; return false; }