VirtualBox

Changeset 31121 in vbox


Ignore:
Timestamp:
Jul 26, 2010 4:31:04 PM (14 years ago)
Author:
vboxsync
Message:

IPRT/Sockets: Fix switch to blocking mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/socket.cpp

    r31106 r31121  
    260260        u_long uBlocking = fBlocking ? 0 : 1;
    261261        if (ioctlsocket(pThis->hNative, FIONBIO, &uBlocking))
    262 #else
    263         if (fcntl(pThis->hNative, F_SETFL, O_NONBLOCK))
    264 #endif
    265262            rc = rtSocketError();
     263#else
     264        int fFlags = fcntl(pThis->hNative, F_GETFL, 0);
     265        if (fFlags != -1)
     266        {
     267            if (fBlocking)
     268                fFlags &= ~O_NONBLOCK;
     269            else
     270                fFlags |= O_NONBLOCK;
     271
     272            if (fcntl(pThis->hNative, F_SETFL, fFlags & ~O_NONBLOCK) == -1)
     273                rc = rtSocketError();
     274        }
    266275        else
     276            rc = rtSocketError();
     277#endif
     278
     279        if (RT_SUCCESS(rc))
    267280            pThis->fBlocking = fBlocking;
    268281    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette