This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make filetest ops handle get-magic correctly for glob(ref)s
[perl5.git] / doio.c
diff --git a/doio.c b/doio.c
index e2c879c..6b5300c 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -861,10 +861,7 @@ Perl_nextargv(pTHX_ register GV *gv)
 #ifdef HAS_FCHMOD
                (void)fchmod(PL_lastfd,PL_filemode);
 #else
-#  if !(defined(WIN32) && defined(__BORLANDC__))
-               /* Borland runtime creates a readonly file! */
                (void)PerlLIO_chmod(PL_oldname,PL_filemode);
-#  endif
 #endif
                if (fileuid != PL_statbuf.st_uid || filegid != PL_statbuf.st_gid) {
 #ifdef HAS_FCHOWN
@@ -1302,12 +1299,7 @@ Perl_my_stat_flags(pTHX_ const U32 flags)
        const char *s;
        STRLEN len;
        PUTBACK;
-       if (isGV_with_GP(sv)) {
-           gv = MUTABLE_GV(sv);
-           goto do_fstat;
-       }
-       else if (SvROK(sv) && isGV_with_GP(SvRV(sv))) {
-           gv = MUTABLE_GV(SvRV(sv));
+       if ((gv = MAYBE_DEREF_GV_flags(sv,flags))) {
            goto do_fstat;
        }
         else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVIO) {
@@ -1347,8 +1339,8 @@ Perl_my_lstat_flags(pTHX_ const U32 flags)
        if (ckWARN(WARN_IO)) {
            Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
                    GvENAME(cGVOP_gv));
-           return (PL_laststatval = -1);
        }
+       return (PL_laststatval = -1);
     }
     else if (PL_laststype != OP_LSTAT
            && (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))