From: Dave Mitchell Date: Sun, 29 Feb 2004 18:06:45 +0000 (+0000) Subject: [perl #24521] make test breaks permissions on /dev/tty X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c797f2d8bff201dfca87c4500d2948210cedc10b;p=p5sagit%2Fp5-mst-13.2.git [perl #24521] make test breaks permissions on /dev/tty perl -i could fchmod(stdin) by mistake p4raw-id: //depot/perl@22415 --- diff --git a/doio.c b/doio.c index f0b036a..7e13f1f 100644 --- a/doio.c +++ b/doio.c @@ -723,11 +723,13 @@ Perl_nextargv(pTHX_ register GV *gv) if (PL_filemode & (S_ISUID|S_ISGID)) { PerlIO_flush(IoIFP(GvIOn(PL_argvoutgv))); /* chmod must follow last write */ #ifdef HAS_FCHMOD - (void)fchmod(PL_lastfd,PL_filemode); + if (PL_lastfd != -1) + (void)fchmod(PL_lastfd,PL_filemode); #else (void)PerlLIO_chmod(PL_oldname,PL_filemode); #endif } + PL_lastfd = -1; PL_filemode = 0; if (!GvAV(gv)) return Nullfp;