diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-03-12 11:46:17 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-03-12 11:46:17 +0000 |
commit | 1d791a44a46c93b2808774b83d9ca1f346372145 (patch) | |
tree | 68c3ccc8e38a6a0db41179f1b9bb06b951e31f32 /perlio.c | |
parent | 89e382121886b3fe97bf9b7381d1b1849bea6bda (diff) | |
download | perl-1d791a44a46c93b2808774b83d9ca1f346372145.tar.gz |
Correct logic error in PerlIOStdio_close() - 0 is an acceptable value
from dup(), so it can't also be the "don't do anything later" value.
p4raw-id: //depot/perl@33491
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3130,7 +3130,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f) int invalidate = 0; IV result = 0; int saveerr = 0; - int dupfd = 0; + int dupfd = -1; #ifdef SOCKS5_VERSION_NAME /* Socks lib overrides close() but stdio isn't linked to that library (though we are) - so we must call close() @@ -3171,7 +3171,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f) /* in SOCKS' case, let close() determine return value */ result = close(fd); #endif - if (dupfd) { + if (dupfd >= 0) { PerlLIO_dup2(dupfd,fd); PerlLIO_close(dupfd); } |