mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 14:28:05 +02:00
libsync: replace dup() with os_dupfd_cloexec()
dup() will leak the new FD into any child process after fork(). Signed-off-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26203>
This commit is contained in:
parent
42509180d4
commit
e4ff98bacb
1 changed files with 2 additions and 1 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <time.h>
|
||||
|
||||
#include "util/detect_os.h"
|
||||
#include "util/os_file.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -222,7 +223,7 @@ static inline int sync_accumulate(const char *name, int *fd1, int fd2)
|
|||
assert(fd2 >= 0);
|
||||
|
||||
if (*fd1 < 0) {
|
||||
*fd1 = dup(fd2);
|
||||
*fd1 = os_dupfd_cloexec(fd2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue