mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
egl/drm: Duplicate fd with F_DUPFD_CLOEXEC to prevent leak
Replacing dup() with fcntl F_DUPFD_CLOEXEC creates the duplicate file descriptor with CLOEXEC so it won't be leaked to child processes if the process fork()s later. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
be5f71d4a5
commit
aaac913e90
1 changed files with 1 additions and 1 deletions
|
|
@ -632,7 +632,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
}
|
||||
|
||||
if (fd < 0) {
|
||||
fd = dup(gbm_device_get_fd(gbm));
|
||||
fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
|
||||
if (fd < 0) {
|
||||
free(dri2_dpy);
|
||||
return EGL_FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue