The problem described in 20010514.031 still wasn't
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index ab43036..826a588 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -70,8 +70,10 @@ extern int h_errno;
 # ifdef I_PWD
 #  include <pwd.h>
 # else
+#  if !defined(VMS)
     struct passwd *getpwnam (char *);
     struct passwd *getpwuid (Uid_t);
+#  endif
 # endif
 # ifdef HAS_GETPWENT
   struct passwd *getpwent (void);
@@ -1561,6 +1563,10 @@ PP(pp_sysread)
                          (struct sockaddr *)namebuf, &bufsize);
        if (count < 0)
            RETPUSHUNDEF;
+#ifdef EPOC
+        /* Bogus return without padding */
+       bufsize = sizeof (struct sockaddr_in);
+#endif
        SvCUR_set(bufsv, count);
        *SvEND(bufsv) = '\0';
        (void)SvPOK_only(bufsv);
@@ -1634,8 +1640,7 @@ PP(pp_sysread)
            count = -1;
     }
     if (count < 0) {
-       if ((IoTYPE(io) == IoTYPE_WRONLY || IoIFP(io) == PerlIO_stdout()
-           || IoIFP(io) == PerlIO_stderr()) && ckWARN(WARN_IO))
+       if ((IoTYPE(io) == IoTYPE_WRONLY) && ckWARN(WARN_IO))
        {
            /* integrate with report_evil_fh()? */
            char *name = NULL;
@@ -2193,6 +2198,9 @@ PP(pp_socket)
        RETPUSHUNDEF;
     }
 
+    if (IoIFP(io))
+       do_close(gv, FALSE);
+
     TAINT_PROPER("socket");
     fd = PerlSock_socket(domain, type, protocol);
     if (fd < 0)
@@ -2251,6 +2259,11 @@ PP(pp_sockpair)
        RETPUSHUNDEF;
     }
 
+    if (IoIFP(io1))
+       do_close(gv1, FALSE);
+    if (IoIFP(io2))
+       do_close(gv2, FALSE);
+
     TAINT_PROPER("socketpair");
     if (PerlSock_socketpair(domain, type, protocol, fd) < 0)
        RETPUSHUNDEF;
@@ -3686,7 +3699,7 @@ PP(pp_readdir)
 {
     dSP;
 #if defined(Direntry_t) && defined(HAS_READDIR)
-#ifndef I_DIRENT
+#if !defined(I_DIRENT) && !defined(VMS)
     Direntry_t *readdir (DIR *);
 #endif
     register Direntry_t *dp;
@@ -3889,7 +3902,13 @@ PP(pp_wait)
     Pid_t childpid;
     int argflags;
 
+#ifdef PERL_OLD_SIGNALS
     childpid = wait4pid(-1, &argflags, 0);
+#else
+    while ((childpid = wait4pid(-1, &argflags, 0)) == -1 && errno == EINTR) {
+       PERL_ASYNC_CHECK();
+    }
+#endif
 #  if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS)
     /* 0 and -1 are both error returns (the former applies to WNOHANG case) */
     STATUS_NATIVE_SET((childpid && childpid != -1) ? argflags : -1);
@@ -3913,7 +3932,13 @@ PP(pp_waitpid)
 
     optype = POPi;
     childpid = TOPi;
+#ifdef PERL_OLD_SIGNALS
     childpid = wait4pid(childpid, &argflags, optype);
+#else
+    while ((childpid = wait4pid(childpid, &argflags, optype)) == -1 && errno == EINTR) {
+       PERL_ASYNC_CHECK();
+    }
+#endif
 #  if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS)
     /* 0 and -1 are both error returns (the former applies to WNOHANG case) */
     STATUS_NATIVE_SET((childpid && childpid != -1) ? argflags : -1);