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 <derekf@osg.samsung.com>
Reviewed-by: Kristian H. Kristensen's avatarKristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.l.velikov@gmail.com>
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) {
free(dri2_dpy);
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