summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_android.c
diff options
context:
space:
mode:
authorMatt Whitlock <freedesktop@mattwhitlock.name>2016-10-01 23:49:41 -0400
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-04 11:08:50 +0200
commitc8fd7d060d000a89f08f690ec72349ab97ae41bc (patch)
tree50507cba18336a0353ba4a4d704c14821476ff6c /src/egl/drivers/dri2/platform_android.c
parent387e0af0b42fefb462a60068fcbdef77236129a0 (diff)
downloadexternal_mesa3d-c8fd7d060d000a89f08f690ec72349ab97ae41bc.zip
external_mesa3d-c8fd7d060d000a89f08f690ec72349ab97ae41bc.tar.gz
external_mesa3d-c8fd7d060d000a89f08f690ec72349ab97ae41bc.tar.bz2
egl/android: replace call to dup(2) with fcntl(F_DUPFD_CLOEXEC)
Without this fix, duplicated file descriptors leak into child processes. See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance where the same fix was employed. Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Matt Whitlock <freedesktop@mattwhitlock.name> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/egl/drivers/dri2/platform_android.c')
-rw-r--r--src/egl/drivers/dri2/platform_android.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 2e0df07..f868984 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include <dlfcn.h>
+#include <fcntl.h>
#include <xf86drm.h>
#if ANDROID_VERSION >= 0x402
@@ -830,7 +831,7 @@ droid_open_device(void)
fd = -1;
}
- return (fd >= 0) ? dup(fd) : -1;
+ return (fd >= 0) ? fcntl(fd, F_DUPFD_CLOEXEC, 3) : -1;
}
/* support versions < JellyBean */