aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/util.cpp b/util.cpp
index 7a947730ce..305db5ceeb 100644
--- a/util.cpp
+++ b/util.cpp
@@ -56,9 +56,11 @@ public:
// Close sockets
foreach(CNode* pnode, vNodes)
- closesocket(pnode->hSocket);
- if (closesocket(hListenSocket) == SOCKET_ERROR)
- printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
+ if (pnode->hSocket != INVALID_SOCKET)
+ closesocket(pnode->hSocket);
+ if (hListenSocket != INVALID_SOCKET)
+ if (closesocket(hListenSocket) == SOCKET_ERROR)
+ printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
#ifdef __WXMSW__
// Shutdown Windows Sockets
@@ -348,7 +350,7 @@ void ParseParameters(int argc, char* argv[])
{
char psz[10000];
strlcpy(psz, argv[i], sizeof(psz));
- char* pszValue = "";
+ char* pszValue = (char*)"";
if (strchr(psz, '='))
{
pszValue = strchr(psz, '=');