diff options
author | Gerrit P. Haase <gp@familiehaase.de> | 2003-08-28 10:18:51 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-30 17:14:19 +0000 |
commit | 95005ad8d24eb76af265f09ad25a68a8b76bf3ae (patch) | |
tree | 49d69541dd2d059603119f66186d560449f146e9 /perlio.c | |
parent | dcccfb9b4e42c4efe169911b5a3b8b70317f0120 (diff) | |
download | perl-95005ad8d24eb76af265f09ad25a68a8b76bf3ae.tar.gz |
A new try at
Subject: [PATCH] maint / blead tweaks in perlio.c for Cygwin
From: "Gerrit P. Haase" <gp@familiehaase.de>
Message-ID: <4157199551.20030828081851@familiehaase.de>
(this time Cygwin only)
p4raw-id: //depot/perl@20954
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 18 |
1 files changed, 13 insertions, 5 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,15 +2710,23 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, fd = PerlLIO_open3(path, imode, perm); } else { - FILE *stdio = PerlSIO_fopen(path, mode); + FILE *stdio; + bool appended = FALSE; +#ifdef __CYGWIN__ + /* Cygwin wants its 'b' early. */ + appended = TRUE; + mode = PerlIOStdio_mode(mode, tmode); +#endif + 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))) { + if (!appended) + mode = PerlIOStdio_mode(mode, tmode); + f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg); + if (f) { s = PerlIOSelf(f, PerlIOStdio); s->stdio = stdio; PerlIOUnix_refcnt_inc(fileno(s->stdio)); |