mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 05:57:43 +00:00
STABLE14-windows-winsock-init-20060829
WSAStartup and WSACleanup do not need to be wrapped by the app to protect against multiple calls. (cherry picked from commit a9bbe0e0dce33fd42cc944db3a657c95af6f6796)
This commit is contained in:
parent
d340c7b656
commit
f6bcf64661
@ -25,18 +25,13 @@ RCSID
|
|||||||
*
|
*
|
||||||
* Returns 0 on success, -1 on error.
|
* Returns 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int once = 1;
|
|
||||||
|
|
||||||
int
|
int
|
||||||
afs_winsockInit(void)
|
afs_winsockInit(void)
|
||||||
{
|
{
|
||||||
if (once) {
|
|
||||||
int code;
|
int code;
|
||||||
WSADATA data;
|
WSADATA data;
|
||||||
WORD sockVersion;
|
WORD sockVersion;
|
||||||
|
|
||||||
once = 0;
|
|
||||||
|
|
||||||
sockVersion = 2;
|
sockVersion = 2;
|
||||||
code = WSAStartup(sockVersion, &data);
|
code = WSAStartup(sockVersion, &data);
|
||||||
if (code)
|
if (code)
|
||||||
@ -44,7 +39,6 @@ afs_winsockInit(void)
|
|||||||
|
|
||||||
if (data.wVersion != 2)
|
if (data.wVersion != 2)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +46,6 @@ void
|
|||||||
afs_winsockCleanup(void)
|
afs_winsockCleanup(void)
|
||||||
{
|
{
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
once = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user