diff options
author | Chip Salzenberg <chip@atlantic.net> | 1996-11-29 10:14:29 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1996-11-30 05:31:00 +1200 |
commit | 7aa04957b681909e6797712355c81abb9f343dc8 (patch) | |
tree | c1bef726c5d3adcabc2c20775b91b8ebf931a04a | |
parent | 95bac841e3f2a590eb559dd46af6c45fa3af0ee3 (diff) | |
download | perl-7aa04957b681909e6797712355c81abb9f343dc8.tar.gz |
Don't call fcntl(fileno(rsfp)) if !rsfp
-rw-r--r-- | perl.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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); |