Skip to content

Commit f50f84c

Browse files
committed
Clone dirhandles without fchdir
1 parent c057bd3 commit f50f84c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sv.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14096,7 +14096,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
1409614096
{
1409714097
DIR *ret;
1409814098

14099-
#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
14099+
#if !defined(HAS_FDOPENDIR) && defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
1410014100
DIR *pwd;
1410114101
const Direntry_t *dirent;
1410214102
char smallbuf[256]; /* XXX MAXPATHLEN, surely? */
@@ -14116,7 +14116,13 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
1411614116
if (ret)
1411714117
return ret;
1411814118

14119-
#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
14119+
#ifdef HAS_FDOPENDIR
14120+
14121+
PERL_UNUSED_ARG(param);
14122+
14123+
ret = fdopendir(dup(my_dirfd(dp)));
14124+
14125+
#elif defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
1412014126

1412114127
PERL_UNUSED_ARG(param);
1412214128

0 commit comments

Comments
 (0)