Tizen 2.0 Release
[profile/ivi/osmesa.git] / debian / patches / 05_kfreebsd-egl-x11.diff
1 From 8aec01a4d5d098430cdb369a69a85cdbf20ebc99 Mon Sep 17 00:00:00 2001
2 From: Julien Cristau <jcristau@debian.org>
3 Date: Thu, 25 Aug 2011 23:08:05 +0200
4 Subject: [PATCH] Work around the lack of O_CLOEXEC on kbsd
5
6 Not that dri2 is going to work there, but well.
7 ---
8  src/egl/drivers/dri2/platform_x11.c |    6 ++++++
9  1 files changed, 6 insertions(+), 0 deletions(-)
10
11 diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
12 index 4e00c95..f38d6c0 100644
13 --- a/src/egl/drivers/dri2/platform_x11.c
14 +++ b/src/egl/drivers/dri2/platform_x11.c
15 @@ -997,7 +997,13 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
16     if (!dri2_load_driver(disp))
17        goto cleanup_conn;
18  
19 +#ifdef O_CLOEXEC
20     dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
21 +#else
22 +   dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
23 +   if (dri2_dpy->fd >= 0)
24 +      fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) | FD_CLOEXEC);
25 +#endif
26     if (dri2_dpy->fd == -1) {
27        _eglLog(_EGL_WARNING,
28               "DRI2: could not open %s (%s)", dri2_dpy->device_name,
29 -- 
30 1.7.2.5
31