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>
*/
#include <unistd.h>
+#include <fcntl.h>
#include "xa_tracker.h"
#include "xa_priv.h"
#include "pipe/p_state.h"
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))