diff options
author | Gerrit P. Haase <gp@familiehaase.de> | 2003-08-28 10:18:51 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-29 12:55:12 +0000 |
commit | 1403d6bf1ee303dd613942fa2f6df0519a053ba6 (patch) | |
tree | abde012979bf7dc5c5896fbdb66b9527ebe6c707 /perlio.c | |
parent | c23d1eb0e18a49361001d26c686323d50b0c6d21 (diff) | |
download | perl-1403d6bf1ee303dd613942fa2f6df0519a053ba6.tar.gz |
maint / blead tweaks in perlio.c for Cygwin
From: "Gerrit P. Haase" <gp@familiehaase.de>
Message-ID: <4157199551.20030828081851@familiehaase.de>
(changed so that the 'b' is always appended)
p4raw-id: //depot/perl@20929
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 41 |
1 files changed, 22 insertions, 19 deletions
@@ -2609,7 +2609,7 @@ PerlIOStdio_mode(const char *mode, char *tmode) while (*mode) { *tmode++ = *mode++; } -#ifdef PERLIO_USING_CRLF +#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__) *tmode++ = 'b'; #endif *tmode = '\0'; @@ -2710,25 +2710,28 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, fd = PerlLIO_open3(path, imode, perm); } else { - FILE *stdio = PerlSIO_fopen(path, mode); - if (stdio) { - PerlIOStdio *s; - if (!f) { - f = PerlIO_allocate(aTHX); - } - if ((f = PerlIO_push(aTHX_ f, self, - (mode = PerlIOStdio_mode(mode, tmode)), - PerlIOArg))) { - s = PerlIOSelf(f, PerlIOStdio); - s->stdio = stdio; - PerlIOUnix_refcnt_inc(fileno(s->stdio)); - } - return f; - } - else { - return NULL; - } + /* Append the 'b' - more correct for CRLF platforms + * and Cygwin and should be harmless (since it's a + * no-op) elsewhere. */ + mode = PerlIOStdio_mode(mode, tmode); + { + FILE *stdio = PerlSIO_fopen(path, mode); + if (stdio) { + PerlIOStdio *s; + if (!f) { + f = PerlIO_allocate(aTHX); + } + if ((f = PerlIO_push(aTHX_ f, self, + mode, PerlIOArg))) { + s = PerlIOSelf(f, PerlIOStdio); + s->stdio = stdio; + PerlIOUnix_refcnt_inc(fileno(s->stdio)); + } + return f; + } + } } + return NULL; } if (fd >= 0) { FILE *stdio = NULL; |