From: Derek Foreman Date: Wed, 17 Jun 2015 16:28:50 +0000 (-0500) Subject: glx: Use loader_open_device() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=324ee9b391ea2db4b74709d30a131e79055bf071;p=mesa.git 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 Reviewed-by: Kristian Høgsberg Reviewed-by: Emil Velikov --- diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 538cf1adb82..27ea9521e50 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;