ben         97/11/01 13:13:25

  Modified:    src/main alloc.c buff.c http_main.c
               src/modules/proxy proxy_util.c
  Log:
  Remove WSABASERROR bollocks. Improve error checking in sendwithtimeout().
  
  Revision  Changes    Path
  1.56      +1 -1      apachen/src/main/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/alloc.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- alloc.c   1997/10/22 20:29:31     1.55
  +++ alloc.c   1997/11/01 21:13:20     1.56
  @@ -1146,7 +1146,7 @@
       block_alarms();
       res = closesocket(sock);
   #ifdef WIN32
  -    errno = WSAGetLastError() - WSABASEERR;
  +    errno = WSAGetLastError();
   #endif /* WIN32 */
       save_errno = errno;
       kill_cleanup(a, (void *) (long) sock, socket_cleanup);
  
  
  
  1.48      +10 -6     apachen/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/buff.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- buff.c    1997/10/22 20:29:32     1.47
  +++ buff.c    1997/11/01 21:13:20     1.48
  @@ -123,15 +123,19 @@
            FD_SET(sock, &fdset);
            tv.tv_usec = 0;
            rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv);
  -         if (rv == 0) {
  +         if (rv == SOCKET_ERROR)
  +             err = WSAGetLastError();
  +         else if (rv == 0) {
                ioctlsocket(sock, FIONBIO, &iostate);
                check_alarm();
                WSASetLastError(WSAEWOULDBLOCK);
                return (SOCKET_ERROR);
            }
  -         rv = send(sock, buf, len, flags);
  -         if (rv == SOCKET_ERROR)
  -             err = WSAGetLastError();
  +         else {
  +             rv = send(sock, buf, len, flags);
  +             if (rv == SOCKET_ERROR)
  +                 err = WSAGetLastError();
  +         }
        }
       }
       ioctlsocket(sock, FIONBIO, &iostate);
  @@ -191,7 +195,7 @@
       if (fb->flags & B_SOCKET) {
        rv = recvwithtimeout(fb->fd_in, buf, nbyte, 0);
        if (rv == SOCKET_ERROR)
  -         errno = WSAGetLastError() - WSABASEERR;
  +         errno = WSAGetLastError();
       }
       else
        rv = read(fb->fd_in, buf, nbyte);
  @@ -210,7 +214,7 @@
       if (fb->flags & B_SOCKET) {
        rv = sendwithtimeout(fb->fd, buf, nbyte, 0);
        if (rv == SOCKET_ERROR)
  -         errno = WSAGetLastError() - WSABASEERR;
  +         errno = WSAGetLastError();
       }
       else
        rv = write(fb->fd, buf, nbyte);
  
  
  
  1.241     +2 -2      apachen/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
  retrieving revision 1.240
  retrieving revision 1.241
  diff -u -r1.240 -r1.241
  --- http_main.c       1997/10/30 19:13:34     1.240
  +++ http_main.c       1997/11/01 21:13:21     1.241
  @@ -3928,7 +3928,7 @@
        srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv);
   #ifdef WIN32
        if (srv == SOCKET_ERROR)
  -         errno = WSAGetLastError() - WSABASEERR;
  +         errno = WSAGetLastError();
   #endif /* WIN32 */
   
        if (srv < 0 && errno != EINTR)
  @@ -3958,7 +3958,7 @@
   #ifdef WIN32
            if (csd == INVALID_SOCKET) {
                csd = -1;
  -             errno = WSAGetLastError() - WSABASEERR;
  +             errno = WSAGetLastError();
            }
   #endif /* WIN32 */
        } while (csd < 0 && errno == EINTR);
  
  
  
  1.35      +1 -1      apachen/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- proxy_util.c      1997/10/30 19:17:56     1.34
  +++ proxy_util.c      1997/11/01 21:13:24     1.35
  @@ -1173,7 +1173,7 @@
        i = connect(sock, (struct sockaddr *) addr, sizeof(struct sockaddr_in));
   #ifdef WIN32
        if (i == SOCKET_ERROR)
  -         errno = WSAGetLastError() - WSABASEERR;
  +         errno = WSAGetLastError();
   #endif /* WIN32 */
       } while (i == -1 && errno == EINTR);
       if (i == -1) {
  
  
  

Reply via email to