diff options
author | Lupe Christoph <lupe@lupe-christoph.de> | 2002-05-25 17:45:34 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-05-25 13:11:52 +0000 |
commit | f504ae08d9ea711c106835665711262bdaa326c7 (patch) | |
tree | 373097570384e911c75a0d6d7f60e1022d063992 /perlio.c | |
parent | f82cdaf628dc6c64b8a3db12878679def5b4b264 (diff) | |
download | perl-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |