Commit 220edd52 authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

Clear the reference counter in WSACleanup, with regression test.

parent 7888e7a5
......@@ -831,8 +831,10 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
*/
INT WINAPI WSACleanup(void)
{
if (num_startup)
if (num_startup) {
num_startup--;
return 0;
}
SetLastError(WSANOTINITIALISED);
return SOCKET_ERROR;
}
......
......@@ -709,8 +709,15 @@ static void Init (void)
static void Exit (void)
{
INT ret, err;
TlsFree ( tls );
ok ( WSACleanup() == 0, "WSACleanup failed\n" );
ret = WSACleanup();
err = WSAGetLastError();
ok ( ret == 0, "WSACleanup failed ret = %d GetLastError is %d\n", ret, err);
ret = WSACleanup();
err = WSAGetLastError();
ok ( ret == SOCKET_ERROR && err == WSANOTINITIALISED,
"WSACleanup returned %d GetLastError is %d\n", ret, err);
}
static void StartServer (LPTHREAD_START_ROUTINE routine,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment