Skip to content

Commit d6f09a8

Browse files
committed
Use PerlLIO_dup_cloexec in Perl_dirp_dup to set O_CLOEXEC
dup doesn't mark the new descriptor as close-on-exec, which can lead to a descriptor leaking to the new process.
1 parent c87d901 commit d6f09a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14111,7 +14111,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
1411114111

1411214112
PERL_UNUSED_ARG(param);
1411314113

14114-
ret = fdopendir(dup(my_dirfd(dp)));
14114+
ret = fdopendir(PerlLIO_dup_cloexec(my_dirfd(dp)));
1411514115

1411614116
#elif defined(WIN32)
1411714117
ret = win32_dirp_dup(dp, param);

0 commit comments

Comments
 (0)