Commit 726da2c3 authored by Yusuf Khan's avatar Yusuf Khan
Browse files

util/os_file: dont assign cloexec when previously assigned



The EGL_MESA_platform_gbm example code placed inside the EGL reg
can crash in nouveau as gbm_create_device is passed with a fd
that already has FD_CLOEXEC and nouveau attempts to add FD_CLOEXEC
to everything passed to it which just leads to nouveau using a bad
fd. Check to make sure cloexec is not assigned before assiging it
when duplicating fds with the flag.

Signed-off-by: Yusuf Khan's avatarYusuf Khan <yusisamerican@gmail.com>
parent 091b5b08
Pipeline #707404 waiting for manual action with stages
in 7 seconds
......@@ -51,6 +51,10 @@ int
os_dupfd_cloexec(int fd)
{
int minfd = 3;
if (fcntl(fd, F_GETFL) & FD_CLOEXEC)
return dup(fd);
int newfd = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
if (newfd >= 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment