Changeset 6996 for trunk/src


Ignore:
Timestamp:
Oct 10, 2001, 10:59:23 PM (24 years ago)
Author:
phaller
Message:

Fixed FS corruption in gethostbyname

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/wsock32.cpp

    r6992 r6996  
    1 /* $Id: wsock32.cpp,v 1.39 2001-10-10 17:20:17 sandervl Exp $ */
     1/* $Id: wsock32.cpp,v 1.40 2001-10-10 20:59:23 phaller Exp $ */
    22
    33/*
     
    12291229              const char *,name)
    12301230{
    1231     LPWSINFO pwsi = WINSOCK_GetIData();
    1232 
    1233     if( pwsi )
     1231  LPWSINFO pwsi = WINSOCK_GetIData();
     1232
     1233  if( pwsi )
     1234  {
     1235    struct hostent*     host;
     1236   
     1237    USHORT sel = RestoreOS2FS();
     1238    host = gethostbyname( (char*) name);
     1239    SetFS(sel);
     1240   
     1241    if( host != NULL )
    12341242    {
    1235         struct hostent*     host;
    1236         if( (host = gethostbyname((char *)name)) != NULL ) {
    1237                 if( WS_dup_he(pwsi, host) ) {
    1238                         WSASetLastError(NO_ERROR);
    1239                         return pwsi->he;
    1240                 }
    1241                 else    WSASetLastError(WSAENOBUFS);
    1242         }
    1243         else    WSASetLastError((h_errno < 0) ? wsaErrno() : wsaHerrno());
     1243      if( WS_dup_he(pwsi, host) )
     1244      {
     1245        WSASetLastError(NO_ERROR);
     1246        return pwsi->he;
     1247      }
     1248      else
     1249        WSASetLastError(WSAENOBUFS);
    12441250    }
    1245     else WSASetLastError(WSANOTINITIALISED);
    1246     return NULL;
     1251    else
     1252      WSASetLastError((h_errno < 0) ? wsaErrno() : wsaHerrno());
     1253  }
     1254  else
     1255    WSASetLastError(WSANOTINITIALISED);
     1256
     1257  return NULL;
    12471258}
    12481259//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.