summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorLupe Christoph <lupe@lupe-christoph.de>2002-05-25 17:45:34 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-25 13:11:52 +0000
commitf504ae08d9ea711c106835665711262bdaa326c7 (patch)
tree373097570384e911c75a0d6d7f60e1022d063992 /perlio.c
parentf82cdaf628dc6c64b8a3db12878679def5b4b264 (diff)
downloadperl-f504ae08d9ea711c106835665711262bdaa326c7.tar.gz
[Patch] Re: ./perl harness on Cygwin today failures
Message-ID: <20020525134534.GT6638@lupe-christoph.de> p4raw-id: //depot/perl@16778
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/perlio.c b/perlio.c
index 23864b56e9..b41b6d2735 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2446,21 +2446,25 @@ PerlIO_importFILE(FILE *stdio, int fl)
/* We need to probe to see how we can open the stream
so start with read/write and then try write and read
we dup() so that we can fclose without loosing the fd.
+
+ Note that the errno value set by a failing fdopen
+ varies between stdio implementations.
*/
int fd = PerlLIO_dup(fileno(stdio));
char *mode = "r+";
FILE *f2 = fdopen(fd, mode);
PerlIOStdio *s;
- if (!f2 && errno == EINVAL) {
+ if (!f2) {
mode = "w";
f2 = fdopen(fd, mode);
}
- if (!f2 && errno == EINVAL) {
+ if (!f2) {
mode = "r";
f2 = fdopen(fd, mode);
}
if (!f2) {
/* Don't seem to be able to open */
+ PerlLIO_close(fd);
return f;
}
fclose(f2);