From bf012ca10a9da916c5db9a6c9500622f055692df Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Wed, 13 Nov 2019 16:00:59 +0300 Subject: [PATCH] WindowServer: Fix leaking framebuffer fd to clients Now that the WindowServer's menu is the primary way to start apps, it is especially noticable that it leaks the /dev/fb0 fd to the apps that it spawns. Fix that by opening it with O_CLOEXEC. --- Servers/WindowServer/WSScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Servers/WindowServer/WSScreen.cpp b/Servers/WindowServer/WSScreen.cpp index 7e76e217f0..c3e2f9f8d4 100644 --- a/Servers/WindowServer/WSScreen.cpp +++ b/Servers/WindowServer/WSScreen.cpp @@ -20,7 +20,7 @@ WSScreen::WSScreen(unsigned desired_width, unsigned desired_height) { ASSERT(!s_the); s_the = this; - m_framebuffer_fd = open("/dev/fb0", O_RDWR); + m_framebuffer_fd = open("/dev/fb0", O_RDWR | O_CLOEXEC); ASSERT(m_framebuffer_fd >= 0); if (fb_set_buffer(m_framebuffer_fd, 0) == 0) {