More ptags tweakage from Stas; now add 'fullpath'
[p5sagit/p5-mst-13.2.git] / win32 / win32sck.c
index 70a3038..2c51cbc 100644 (file)
@@ -35,7 +35,7 @@
 #      define TO_SOCKET(x)     (x)
 #endif /* USE_SOCKETS_AS_HANDLES */
 
-#if defined(USE_5005THREADS) || defined(USE_ITHREADS)
+#if defined(USE_ITHREADS)
 #define StartSockets() \
     STMT_START {                                       \
        if (!wsock_started)                             \
@@ -100,7 +100,7 @@ void
 set_socktype(void)
 {
 #ifdef USE_SOCKETS_AS_HANDLES
-#if defined(USE_5005THREADS) || defined(USE_ITHREADS)
+#if defined(USE_ITHREADS)
     dTHX;
     if (!w32_init_socktype) {
 #endif
@@ -110,7 +110,7 @@ set_socktype(void)
         */
        setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
                    (char *)&iSockOpt, sizeof(iSockOpt));
-#if defined(USE_5005THREADS) || defined(USE_ITHREADS)
+#if defined(USE_ITHREADS)
        w32_init_socktype = 1;
     }
 #endif
@@ -291,7 +291,7 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, const
     int r;
 #ifdef USE_SOCKETS_AS_HANDLES
     Perl_fd_set dummy;
-    int i, fd, bit, offset;
+    int i, fd, save_errno = errno;
     FD_SET nrd, nwr, nex, *prd, *pwr, *pex;
 
     /* winsock seems incapable of dealing with all three null fd_sets,
@@ -333,7 +333,9 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, const
            FD_SET(fd, &nex);
     }
 
+    errno = save_errno;
     SOCKET_TEST_ERROR(r = select(nfds, prd, pwr, pex, timeout));
+    save_errno = errno;
 
     for (i = 0; i < nfds; i++) {
        fd = TO_SOCKET(i);
@@ -344,6 +346,7 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, const
        if (PERL_FD_ISSET(i,ex) && !FD_ISSET(fd, &nex))
            PERL_FD_CLR(i,ex);
     }
+    errno = save_errno;
 #else
     SOCKET_TEST_ERROR(r = select(nfds, rd, wr, ex, timeout));
 #endif