From: Gurusamy Sarathy Date: Sat, 4 Mar 2000 19:02:27 +0000 (+0000) Subject: avoid looking up stale PL_statbuf (spotted by Charles Lane X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6af84f9fb71a3207be80bf9d2f1ad85d0d98bd09;p=p5sagit%2Fp5-mst-13.2.git avoid looking up stale PL_statbuf (spotted by Charles Lane ) p4raw-id: //depot/perl@5524 --- diff --git a/doio.c b/doio.c index d0a7704..3cd199b 100644 --- a/doio.c +++ b/doio.c @@ -646,13 +646,17 @@ Perl_nextargv(pTHX_ register GV *gv) else { dTHR; if (ckWARN_d(WARN_INPLACE)) { - if (!S_ISREG(PL_statbuf.st_mode)) + int eno = errno; + if (PerlLIO_stat(PL_oldname, &PL_statbuf) >= 0 + && !S_ISREG(PL_statbuf.st_mode)) + { Perl_warner(aTHX_ WARN_INPLACE, "Can't do inplace edit: %s is not a regular file", PL_oldname); + } else Perl_warner(aTHX_ WARN_INPLACE, "Can't open %s: %s", - PL_oldname, Strerror(errno)); + PL_oldname, Strerror(eno)); } } }