[Mesa-dev] [PATCH 3/5] winsys/svga/drm: replace calls to dup(2) with fcntl(F_DUPFD_CLOEXEC)
Matt Whitlock
freedesktop at mattwhitlock.name
Tue Mar 27 00:57:31 UTC 2018
Without this fix, duplicated file descriptors leak into child processes.
See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance
where the same fix was employed.
Signed-off-by: Matt Whitlock <freedesktop at mattwhitlock.name>
---
src/gallium/winsys/svga/drm/vmw_screen_svga.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 7c80642b37..d35cdf9d6a 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -139,7 +139,7 @@ vmw_svga_winsys_fence_get_fd(struct svga_winsys_screen *sws,
boolean duplicate)
{
if (duplicate)
- return dup(vmw_fence_get_fd(fence));
+ return fcntl(vmw_fence_get_fd(fence), F_DUPFD_CLOEXEC, 3);
else
return vmw_fence_get_fd(fence);
}
@@ -150,7 +150,7 @@ vmw_svga_winsys_fence_create_fd(struct svga_winsys_screen *sws,
struct pipe_fence_handle **fence,
int32_t fd)
{
- *fence = vmw_fence_create(NULL, 0, 0, 0, dup(fd));
+ *fence = vmw_fence_create(NULL, 0, 0, 0, fcntl(fd, F_DUPFD_CLOEXEC, 3));
}
static int
--
2.16.3
More information about the mesa-dev
mailing list