Mesa (master): egl_dri2.c: Open drm device with O_CLOEXEC

Kristian Høgsberg krh at kemper.freedesktop.org
Thu Apr 7 23:16:22 UTC 2011


Module: Mesa
Branch: master
Commit: 55a629cee5c20b357cca5c767a14fb27d9691e16
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=55a629cee5c20b357cca5c767a14fb27d9691e16

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Thu Apr  7 18:27:06 2011 -0400

egl_dri2.c: Open drm device with O_CLOEXEC

Not a good fd to leak.

---

 src/egl/drivers/dri2/platform_x11.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index e7fe95d..5d4ac6a 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -990,7 +990,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
    if (!dri2_load_driver(disp))
       goto cleanup_conn;
 
-   dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
+   dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
    if (dri2_dpy->fd == -1) {
       _eglLog(_EGL_WARNING,
 	      "DRI2: could not open %s (%s)", dri2_dpy->device_name,




More information about the mesa-commit mailing list