gallium/winsys: replace calls to dup(2) with fcntl(F_DUPFD_CLOEXEC)
[mesa.git] / src / gallium / winsys / nouveau / drm / nouveau_drm_winsys.c
index f90572f2f487d3149c61b02101a2c63251d3ba55..cc9dfa7f7645c8c201c5fd113ba80041ba3a76d7 100644 (file)
@@ -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)