Change 16528 by nick@camel-linux on 2002/05/09 16:40:39
Integrate maint branch io (pipe) fixes.
Affected files ...
.... //depot/perl/doio.c#200 integrate
.... //depot/perl/pp_sys.c#306 integrate
.... //depot/perl/util.c#346 integrate
Differences ...
==== //depot/perl/doio.c#200 (text) ====
Index: perl/doio.c
--- perl/doio.c#199~16382~ Fri May 3 13:14:07 2002
+++ perl/doio.c Thu May 9 09:40:39 2002
@@ -904,6 +904,7 @@
goto badexit;
IoIFP(rstio) = PerlIO_fdopen(fd[0], "r");
IoOFP(wstio) = PerlIO_fdopen(fd[1], "w");
+ IoOFP(rstio) = IoIFP(rstio);
IoIFP(wstio) = IoOFP(wstio);
IoTYPE(rstio) = IoTYPE_RDONLY;
IoTYPE(wstio) = IoTYPE_WRONLY;
==== //depot/perl/pp_sys.c#306 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#305~16501~ Wed May 8 15:39:11 2002
+++ perl/pp_sys.c Thu May 9 09:40:39 2002
@@ -608,6 +608,7 @@
IoIFP(rstio) = PerlIO_fdopen(fd[0], "r");
IoOFP(wstio) = PerlIO_fdopen(fd[1], "w");
+ IoOFP(rstio) = IoIFP(rstio);
IoIFP(wstio) = IoOFP(wstio);
IoTYPE(rstio) = IoTYPE_RDONLY;
IoTYPE(wstio) = IoTYPE_WRONLY;
==== //depot/perl/util.c#346 (text) ====
Index: perl/util.c
--- perl/util.c#345~16348~ Thu May 2 08:44:48 2002
+++ perl/util.c Thu May 9 09:40:39 2002
@@ -2096,6 +2096,7 @@
while ((pid = PerlProc_fork()) < 0) {
if (errno != EAGAIN) {
PerlLIO_close(p[This]);
+ PerlLIO_close(p[that]);
if (did_pipes) {
PerlLIO_close(pp[0]);
PerlLIO_close(pp[1]);
@@ -2113,7 +2114,6 @@
#undef THAT
#define THIS that
#define THAT This
- PerlLIO_close(p[THAT]);
if (did_pipes) {
PerlLIO_close(pp[0]);
#if defined(HAS_FCNTL) && defined(F_SETFD)
@@ -2123,7 +2123,11 @@
if (p[THIS] != (*mode == 'r')) {
PerlLIO_dup2(p[THIS], *mode == 'r');
PerlLIO_close(p[THIS]);
+ if (p[THAT] != (*mode == 'r')) /* if dup2() didn't close it */
+ PerlLIO_close(p[THAT]);
}
+ else
+ PerlLIO_close(p[THAT]);
#ifndef OS2
if (doexec) {
#if !defined(HAS_FCNTL) || !defined(F_SETFD)
@@ -2157,8 +2161,7 @@
#undef THIS
#undef THAT
}
- do_execfree(); /* free any memory malloced by child on fork */
- PerlLIO_close(p[that]);
+ do_execfree(); /* free any memory malloced by child on vfork */
if (did_pipes)
PerlLIO_close(pp[1]);
if (p[that] < p[This]) {
@@ -2166,6 +2169,9 @@
PerlLIO_close(p[This]);
p[This] = p[that];
}
+ else
+ PerlLIO_close(p[that]);
+
LOCK_FDPID_MUTEX;
sv = *av_fetch(PL_fdpid,p[This],TRUE);
UNLOCK_FDPID_MUTEX;
@@ -4216,7 +4222,7 @@
}
#endif /* EMULATE_SOCKETPAIR_UDP */
-#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) &&
defined(PF_INET)
+#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) &&
+defined(PF_INET)
int
Perl_my_socketpair (int family, int type, int protocol, int fd[2]) {
/* Stevens says that family must be AF_LOCAL, protocol 0.
End of Patch.