Skip to content

Commit 0bb1701

Browse files
Leontsteve-m-hay
authored andcommitted
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. (cherry picked from commit d6f09a8)
1 parent 0ebba20 commit 0bb1701

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
@@ -13959,7 +13959,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
1395913959

1396013960
PERL_UNUSED_ARG(param);
1396113961

13962-
ret = fdopendir(dup(my_dirfd(dp)));
13962+
ret = fdopendir(PerlLIO_dup_cloexec(my_dirfd(dp)));
1396313963

1396413964
#elif defined(WIN32)
1396513965
ret = win32_dirp_dup(dp, param);

0 commit comments

Comments
 (0)