egl/android: replace call to dup(2) with fcntl(F_DUPFD_CLOEXEC)
Without this fix, duplicated file descriptors leak into child processes.
See commit aaac913e90 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>
This commit is contained in:
committed by
Nicolai Hähnle
parent
387e0af0b4
commit
c8fd7d060d
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user