while (*mode) {
*tmode++ = *mode++;
}
-#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
+#ifdef PERLIO_USING_CRLF
*tmode++ = 'b';
#endif
*tmode = '\0';
fd = PerlLIO_open3(path, imode, perm);
}
else {
- /* 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;
- }
- }
+ 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;
+ }
}
- return NULL;
}
if (fd >= 0) {
FILE *stdio = NULL;