From: Chip Salzenberg Date: Thu, 28 Nov 1996 22:14:29 +0000 (+1200) Subject: Don't call fcntl(fileno(rsfp)) if !rsfp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7aa04957b681909e6797712355c81abb9f343dc8;p=p5sagit%2Fp5-mst-13.2.git Don't call fcntl(fileno(rsfp)) if !rsfp --- diff --git a/perl.c b/perl.c index 0bb3e8f..4777070 100644 --- a/perl.c +++ b/perl.c @@ -1519,7 +1519,8 @@ SV *sv; if (fdscript >= 0) { rsfp = PerlIO_fdopen(fdscript,"r"); #if defined(HAS_FCNTL) && defined(F_SETFD) - fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */ + if (rsfp) + fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */ #endif } else if (preprocess) { @@ -1597,13 +1598,14 @@ sed %s -e \"/^[^#]/b\" \ else { rsfp = PerlIO_open(scriptname,"r"); #if defined(HAS_FCNTL) && defined(F_SETFD) - fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */ + if (rsfp) + fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */ #endif } if (e_tmpname) { e_fp = rsfp; } - if ((PerlIO*)rsfp == Nullfp) { + if (!rsfp) { #ifdef DOSUID #ifndef IAMSUID /* in case script is not readable before setuid */ if (euid && Stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 && @@ -2000,11 +2002,11 @@ nuke_stacks() } static PerlIO *tmpfp; /* moved outside init_lexer() because of UNICOS bug */ + static void init_lexer() { tmpfp = rsfp; - lex_start(linestr); rsfp = tmpfp; subname = newSVpv("main",4);