diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2015-06-17 11:28:51 -0500 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-06-23 16:54:56 +0100 |
commit | 4f8f790525f1adcb5259cb72b7c9dbfd121867c6 (patch) | |
tree | c244e9662035fdcb1fda5be579aa70e79b33292d /src/egl/drivers/dri2/platform_wayland.c | |
parent | 324ee9b391ea2db4b74709d30a131e79055bf071 (diff) | |
download | external_mesa3d-4f8f790525f1adcb5259cb72b7c9dbfd121867c6.zip external_mesa3d-4f8f790525f1adcb5259cb72b7c9dbfd121867c6.tar.gz external_mesa3d-4f8f790525f1adcb5259cb72b7c9dbfd121867c6.tar.bz2 |
egl: Use the loader_open_device() helper to do open with CLOEXEC
We've moved the open with CLOEXEC idiom into a helper function, so
call it instead of duplicating the code.
This also replaces a couple of opens that didn't properly do CLOEXEC.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'src/egl/drivers/dri2/platform_wayland.c')
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index ea2f9f2..1c98552 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -891,16 +891,7 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device) if (!dri2_dpy->device_name) return; -#ifdef O_CLOEXEC - dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC); - if (dri2_dpy->fd == -1 && errno == EINVAL) -#endif - { - dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR); - if (dri2_dpy->fd != -1) - fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) | - FD_CLOEXEC); - } + dri2_dpy->fd = loader_open_device(dri2_dpy->device_name); if (dri2_dpy->fd == -1) { _eglLog(_EGL_WARNING, "wayland-egl: could not open %s (%s)", dri2_dpy->device_name, strerror(errno)); |