Commit aaac913e authored by Derek Foreman's avatar Derek Foreman Committed by Emil Velikov

egl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak

Replacing dup() with fcntl F_DUPFD_CLOEXEC creates the duplicate
file descriptor with CLOEXEC so it won't be leaked to child
processes if the process fork()s later.
Signed-off-by: default avatarDerek Foreman <>
Reviewed-by: Kristian H. Kristensen's avatarKristian Høgsberg <>
Reviewed-by: Emil Velikov's avatarEmil Velikov <>
parent be5f71d4
......@@ -632,7 +632,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
if (fd < 0) {
fd = dup(gbm_device_get_fd(gbm));
fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
if (fd < 0) {
return EGL_FALSE;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment