Mesa (master): glx: Use loader_open_device() helper

Emil Velikov evelikov at kemper.freedesktop.org
Tue Jun 23 16:07:39 UTC 2015


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

Author: Derek Foreman <derekf at osg.samsung.com>
Date:   Wed Jun 17 11:28:50 2015 -0500

glx: Use loader_open_device() helper

We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code here.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

---

 src/glx/dri2_glx.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 538cf1a..27ea952 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1183,15 +1183,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
       return NULL;
    }
 
-#ifdef O_CLOEXEC
-   psc->fd = open(deviceName, O_RDWR | O_CLOEXEC);
-   if (psc->fd == -1 && errno == EINVAL)
-#endif
-   {
-      psc->fd = open(deviceName, O_RDWR);
-      if (psc->fd != -1)
-         fcntl(psc->fd, F_SETFD, fcntl(psc->fd, F_GETFD) | FD_CLOEXEC);
-   }
+   psc->fd = loader_open_device(deviceName);
    if (psc->fd < 0) {
       ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
       goto handle_error;




More information about the mesa-commit mailing list