Module: Mesa Branch: master Commit: aaac913e901229d11a1894f6aaf646de6b1a542c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aaac913e901229d11a1894f6aaf646de6b1a542c
Author: Derek Foreman <der...@osg.samsung.com> Date: Wed Jun 17 11:28:48 2015 -0500 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: Derek Foreman <der...@osg.samsung.com> Reviewed-by: Kristian Høgsberg <k...@bitplanet.net> Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com> --- src/egl/drivers/dri2/platform_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 3391afc..c97c54f 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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; _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit