diff options
author | Steve Peters <steve@fisharerojo.org> | 2007-03-09 18:30:16 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2007-03-09 18:30:16 +0000 |
commit | c08d693782d39895d445f7f2825c1f8240fc9f5a (patch) | |
tree | 6b7900828b126afa9c1d8f2b469cca23c809dd16 /pp_sys.c | |
parent | a1966b02deefb3dca0ce106aaed7a2b0729fdc7e (diff) | |
download | perl-c08d693782d39895d445f7f2825c1f8240fc9f5a.tar.gz |
Prefer dirhandles to filehandles when passing a bareword typeglob
to chdir() and the typeglob has both a dirhandle and a
filehandle assigned to it.
p4raw-id: //depot/perl@30527
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -3442,15 +3442,14 @@ PP(pp_chdir) #ifdef HAS_FCHDIR IO* const io = GvIO(gv); if (io) { - if (IoIFP(io)) { - PUSHi(fchdir(PerlIO_fileno(IoIFP(io))) >= 0); - } - else if (IoDIRP(io)) { + if (IoDIRP(io)) { #ifdef HAS_DIRFD PUSHi(fchdir(dirfd(IoDIRP(io))) >= 0); #else DIE(aTHX_ PL_no_func, "dirfd"); #endif + } else if (IoIFP(io)) { + PUSHi(fchdir(PerlIO_fileno(IoIFP(io))) >= 0); } else { if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) |