Commit 39137559 authored by Ian Craggs's avatar Ian Craggs

Some small changes to PR #200

parent 963259de
/*******************************************************************************
* Copyright (c) 2009, 2016 IBM Corp.
* Copyright (c) 2009, 2017 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,6 +14,7 @@
* Ian Craggs - initial implementation and documentation
* Ian Craggs - async client updates
* Ian Craggs - fix for bug 484496
* Juergen Kosel, Ian Craggs - fix for issue #135
*******************************************************************************/
/**
......@@ -619,7 +620,7 @@ int Socket_new(char* addr, int port, int* sock)
struct addrinfo* res = result;
while (res)
{ /* prefer ip4 addresses */
{ /* prefer ip4 addresses */
if (res->ai_family == AF_INET || res->ai_next == NULL)
break;
res = res->ai_next;
......@@ -693,10 +694,10 @@ int Socket_new(char* addr, int port, int* sock)
* as reported in
* https://github.com/eclipse/paho.mqtt.c/issues/135
*/
if (rc && (rc != EINPROGRESS) && (rc != EWOULDBLOCK))
if (rc != 0 && (rc != EINPROGRESS) && (rc != EWOULDBLOCK))
{
Socket_close(*sock); // close socket and remove from our list of sockets
*sock = -1; // as initialized before
Socket_close(*sock); /* close socket and remove from our list of sockets */
*sock = -1; /* as initialized before */
}
}
}
......
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