This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
AW: [perl #36291] incorrect $! from open ">&nr" with too many open files
authorPeter Dintelmann <Peter.Dintelmann@Dresdner-Bank.com>
Tue, 27 Sep 2005 15:18:00 +0000 (17:18 +0200)
committerSteve Peters <steve@fisharerojo.org>
Tue, 27 Sep 2005 15:05:18 +0000 (15:05 +0000)
From: "Dintelmann, Peter" <Peter.Dintelmann@Dresdner-Bank.com>
Date: Tue, 27 Sep 2005 15:18:00 +0200

p4raw-id: //depot/perl@25621

doio.c

diff --git a/doio.c b/doio.c
index 4f30a59..26554cf 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -408,7 +408,7 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
                        else
                            was_fdopen = TRUE;
                        if (!(fp = PerlIO_openn(aTHX_ type,mode,fd,0,0,NULL,num_svs,svp))) {
-                           if (dodup)
+                           if (dodup && fd >= 0)
                                PerlLIO_close(fd);
                        }
                    }