From: Gurusamy Sarathy Date: Sat, 19 Oct 2002 12:11:43 +0000 (-0700) Subject: Re: Is this true that Perl 5.8 uses :crlf as default DISCIPLINE on so ckets? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=479b2847c3fbb8fe8ee4a5811514a771839458c4;p=p5sagit%2Fp5-mst-13.2.git Re: Is this true that Perl 5.8 uses :crlf as default DISCIPLINE on so ckets? Message-Id: <200210191911.g9JJBhK02618@smtp3.ActiveState.com> p4raw-id: //depot/perl@18120 --- diff --git a/doio.c b/doio.c index 2da66c6..9cfcc4e 100644 --- a/doio.c +++ b/doio.c @@ -923,8 +923,8 @@ Perl_do_pipe(pTHX_ SV *sv, GV *rgv, GV *wgv) if (PerlProc_pipe(fd) < 0) goto badexit; - IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"); - IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"); + IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); + IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); IoOFP(rstio) = IoIFP(rstio); IoIFP(wstio) = IoOFP(wstio); IoTYPE(rstio) = IoTYPE_RDONLY; diff --git a/perl.h b/perl.h index d453cb6..4436d1a 100644 --- a/perl.h +++ b/perl.h @@ -4163,6 +4163,10 @@ extern void moncontrol(int); #define UNICODE_PARA_SEPA_1 0x80 #define UNICODE_PARA_SEPA_2 0xA9 +#ifndef PIPESOCK_MODE +# define PIPESOCK_MODE +#endif + /* and finally... */ #define PERL_PATCHLEVEL_H_IMPLICIT #include "patchlevel.h" diff --git a/pp_sys.c b/pp_sys.c index 2939e90..f1eb1b9 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -608,8 +608,8 @@ PP(pp_pipe_op) if (PerlProc_pipe(fd) < 0) goto badexit; - IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"); - IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"); + IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); + IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); IoOFP(rstio) = IoIFP(rstio); IoIFP(wstio) = IoOFP(wstio); IoTYPE(rstio) = IoTYPE_RDONLY; @@ -2281,8 +2281,8 @@ PP(pp_socket) fd = PerlSock_socket(domain, type, protocol); if (fd < 0) RETPUSHUNDEF; - IoIFP(io) = PerlIO_fdopen(fd, "r"); /* stdio gets confused about sockets */ - IoOFP(io) = PerlIO_fdopen(fd, "w"); + IoIFP(io) = PerlIO_fdopen(fd, "r"PIPESOCK_MODE); /* stdio gets confused about sockets */ + IoOFP(io) = PerlIO_fdopen(fd, "w"PIPESOCK_MODE); IoTYPE(io) = IoTYPE_SOCKET; if (!IoIFP(io) || !IoOFP(io)) { if (IoIFP(io)) PerlIO_close(IoIFP(io)); @@ -2343,11 +2343,11 @@ PP(pp_sockpair) TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; - IoIFP(io1) = PerlIO_fdopen(fd[0], "r"); - IoOFP(io1) = PerlIO_fdopen(fd[0], "w"); + IoIFP(io1) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); + IoOFP(io1) = PerlIO_fdopen(fd[0], "w"PIPESOCK_MODE); IoTYPE(io1) = IoTYPE_SOCKET; - IoIFP(io2) = PerlIO_fdopen(fd[1], "r"); - IoOFP(io2) = PerlIO_fdopen(fd[1], "w"); + IoIFP(io2) = PerlIO_fdopen(fd[1], "r"PIPESOCK_MODE); + IoOFP(io2) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); IoTYPE(io2) = IoTYPE_SOCKET; if (!IoIFP(io1) || !IoOFP(io1) || !IoIFP(io2) || !IoOFP(io2)) { if (IoIFP(io1)) PerlIO_close(IoIFP(io1)); @@ -2515,12 +2515,12 @@ PP(pp_accept) goto badexit; if (IoIFP(nstio)) do_close(ngv, FALSE); - IoIFP(nstio) = PerlIO_fdopen(fd, "r"); + IoIFP(nstio) = PerlIO_fdopen(fd, "r"PIPESOCK_MODE); /* FIXME: we dup(fd) here so that refcounting of fd's does not inhibit fclose of IoOFP's FILE * - and hence leak memory. Special treatment of _this_ case of IoIFP != IoOFP seems wrong. */ - IoOFP(nstio) = PerlIO_fdopen(fd2 = PerlLIO_dup(fd), "w"); + IoOFP(nstio) = PerlIO_fdopen(fd2 = PerlLIO_dup(fd), "w"PIPESOCK_MODE); IoTYPE(nstio) = IoTYPE_SOCKET; if (!IoIFP(nstio) || !IoOFP(nstio)) { if (IoIFP(nstio)) PerlIO_close(IoIFP(nstio)); diff --git a/win32/win32.h b/win32/win32.h index d1c2325..849f13b 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -140,6 +140,8 @@ struct utsname { #endif #define ENV_IS_CASELESS +#define PIPESOCK_MODE "b" /* pipes, sockets default to binmode */ + #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ #define VER_PLATFORM_WIN32_WINDOWS 1 #endif