summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/base/winsock_init.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/net/base/winsock_init.cc b/net/base/winsock_init.cc
index 190ed77..5c3f005 100644
--- a/net/base/winsock_init.cc
+++ b/net/base/winsock_init.cc
@@ -6,6 +6,7 @@
#include "net/base/winsock_init.h"
+#include "base/logging.h"
#include "base/singleton.h"
namespace {
@@ -13,17 +14,21 @@ namespace {
class WinsockInitSingleton {
public:
WinsockInitSingleton() : did_init_(false) {
- WORD winsock_ver = MAKEWORD(2,2);
+ WORD winsock_ver = MAKEWORD(2, 2);
WSAData wsa_data;
did_init_ = (WSAStartup(winsock_ver, &wsa_data) == 0);
-
- // The first time WSAGetLastError is called, the delay load helper will
- // resolve the address with GetProcAddress and fixup the import. If a third
- // party application hooks system functions without correctly restoring the
- // error code, it is possible that the error code will be overwritten during
- // delay load resolution. The result of the first call may be incorrect, so
- // make sure the function is bound and future results will be correct.
- WSAGetLastError();
+ if (did_init_) {
+ DCHECK(wsa_data.wVersion == winsock_ver);
+
+ // The first time WSAGetLastError is called, the delay load helper will
+ // resolve the address with GetProcAddress and fixup the import. If a
+ // third party application hooks system functions without correctly
+ // restoring the error code, it is possible that the error code will be
+ // overwritten during delay load resolution. The result of the first
+ // call may be incorrect, so make sure the function is bound and future
+ // results will be correct.
+ WSAGetLastError();
+ }
}
~WinsockInitSingleton() {