summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-04-20 18:28:35 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-04-20 18:28:35 +0000
commitbd4a56683d81031daed35526f008ae02a99cad90 (patch)
treec83fd1e4ef394c3cf9c82c037e709acf14e4f282 /doio.c
parent7359b62bc3a11c954051ab3c3b794dba7a042bba (diff)
downloadperl-bd4a56683d81031daed35526f008ae02a99cad90.tar.gz
Avoid core dump on
open(STDOUT,">",\$foo); p4raw-id: //depot/perlio@9766
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 631149db41..f65f2867fb 100644
--- a/doio.c
+++ b/doio.c
@@ -555,7 +555,10 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
if (savefd != fd) {
Pid_t pid;
SV *sv;
- PerlLIO_dup2(fd, savefd);
+ if (PerlLIO_dup2(fd, savefd) < 0) {
+ (void)PerlIO_close(fp);
+ goto say_false;
+ }
#ifdef VMS
if (savefd != PerlIO_fileno(PerlIO_stdin())) {
char newname[FILENAME_MAX+1];