From c8fd7d060d000a89f08f690ec72349ab97ae41bc Mon Sep 17 00:00:00 2001 From: Matt Whitlock Date: Sat, 1 Oct 2016 23:49:41 -0400 Subject: egl/android: replace call to dup(2) with fcntl(F_DUPFD_CLOEXEC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this fix, duplicated file descriptors leak into child processes. See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance where the same fix was employed. Cc: Signed-off-by: Matt Whitlock Reviewed-by: Nicolai Hähnle --- src/egl/drivers/dri2/platform_android.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/egl') diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 2e0df077f85..f86898401c6 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -29,6 +29,7 @@ #include #include +#include #include #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 */ -- cgit v1.2.3