summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMatt Whitlock <freedesktop@mattwhitlock.name>2016-10-01 23:49:44 -0400
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-04 11:09:01 +0200
commitac6064f91898065c8b82255190a0508204d3f88c (patch)
treeeaad9dd27a19d5002ed320b8db8c0d82e9ebd6be /src/gallium
parent0c060f691c0827b0a66e97a4a7f54385de14cdb8 (diff)
downloadexternal_mesa3d-ac6064f91898065c8b82255190a0508204d3f88c.zip
external_mesa3d-ac6064f91898065c8b82255190a0508204d3f88c.tar.gz
external_mesa3d-ac6064f91898065c8b82255190a0508204d3f88c.tar.bz2
st/xa: 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/gallium')
-rw-r--r--src/gallium/state_trackers/xa/xa_tracker.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index d98bd2d..03a3abf 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -27,6 +27,7 @@
*/
#include <unistd.h>
+#include <fcntl.h>
#include "xa_tracker.h"
#include "xa_priv.h"
#include "pipe/p_state.h"
@@ -157,7 +158,7 @@ xa_tracker_create(int drm_fd)
if (!xa)
return NULL;
- if (drm_fd < 0 || (fd = dup(drm_fd)) < 0)
+ if (drm_fd < 0 || (fd = fcntl(drm_fd, F_DUPFD_CLOEXEC, 3)) < 0)
goto out_no_fd;
if (pipe_loader_drm_probe_fd(&xa->dev, fd))