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 <freedesk...@mattwhitlock.name>
---
 src/gallium/drivers/freedreno/freedreno_fence.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c 
b/src/gallium/drivers/freedreno/freedreno_fence.c
index 1925f726a2..e49c276f29 100644
--- a/src/gallium/drivers/freedreno/freedreno_fence.c
+++ b/src/gallium/drivers/freedreno/freedreno_fence.c
@@ -124,7 +124,7 @@ void fd_create_fence_fd(struct pipe_context *pctx,
                enum pipe_fd_type type)
 {
        assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
-       *pfence = fence_create(fd_context(pctx), NULL, 0, dup(fd));
+       *pfence = fence_create(fd_context(pctx), NULL, 0, fcntl(fd, 
F_DUPFD_CLOEXEC, 3));
 }
 
 void fd_fence_server_sync(struct pipe_context *pctx,
@@ -144,7 +144,7 @@ int fd_fence_get_fd(struct pipe_screen *pscreen,
                struct pipe_fence_handle *fence)
 {
        fence_flush(fence);
-       return dup(fence->fence_fd);
+       return fcntl(fence->fence_fd, F_DUPFD_CLOEXEC, 3);
 }
 
 struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch)
-- 
2.16.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to