diff options
author | Matt Whitlock <[email protected]> | 2016-10-01 23:49:45 -0400 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-10-04 11:09:03 +0200 |
commit | 42ed8a6c9ccfb8b6b632c3be90fb03d292f53d25 (patch) | |
tree | 40dd06c9d73546f182915bdb13c00653cc5d458e /src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | |
parent | ac6064f91898065c8b82255190a0508204d3f88c (diff) |
gallium/winsys: replace calls 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: <[email protected]>
Signed-off-by: Matt Whitlock <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c')
-rw-r--r-- | src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index f90572f2f48..cc9dfa7f764 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -1,5 +1,6 @@ #include <sys/stat.h> #include <unistd.h> +#include <fcntl.h> #include "pipe/p_context.h" #include "pipe/p_state.h" #include "util/u_format.h" @@ -91,7 +92,7 @@ nouveau_drm_screen_create(int fd) * nouveau_device_wrap does not close the fd in case of a device * creation error. */ - dupfd = dup(fd); + dupfd = fcntl(fd, F_DUPFD_CLOEXEC, 3); ret = nouveau_drm_new(dupfd, &drm); if (ret) |