socket() can return 0 as a valid socket. This can happen
when using a daemon that closes stdin/out/err.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
#endif
static pthread_mutex_t acm_lock = PTHREAD_MUTEX_INITIALIZER;
-static int sock;
+static int sock = -1;
static short server_port = 6125;
struct ib_connect_hdr {
err:
close(sock);
- sock = 0;
+ sock = -1;
}
void ucma_ib_cleanup(void)
{
- if (sock > 0) {
+ if (sock >= 0) {
shutdown(sock, SHUT_RDWR);
close(sock);
}
struct acm_ep_addr_data *data;
int ret;
- if (sock <= 0)
+ if (sock < 0)
return;
memset(&msg, 0, sizeof msg);