diff --git a/clients/lcdexec/lcdexec.c b/clients/lcdexec/lcdexec.c index 2ea0fbe..f3b7aea 100644 --- a/clients/lcdexec/lcdexec.c +++ b/clients/lcdexec/lcdexec.c @@ -226,7 +226,7 @@ int connect_and_setup() report(RPT_INFO, "Connecting to %s:%d", address, port); sock = sock_connect(address, port); - if (sock <= 0) { + if (sock < 0) { return -1; } diff --git a/clients/lcdproc/iface.c b/clients/lcdproc/iface.c index fbb2077..f94d8f2 100644 --- a/clients/lcdproc/iface.c +++ b/clients/lcdproc/iface.c @@ -138,7 +138,7 @@ main (int argc, char **argv) /* Try to connect to server */ sock = sock_connect(server, port); - if (sock <= 0) { /* there was some error and exit */ + if (sock < 0) { /* there was some error and exit */ fprintf(stderr, "Error: Could not connect to %s:%d\n", server, port); exit(0); } diff --git a/clients/lcdproc/main.c b/clients/lcdproc/main.c index e3963ff..80a13c6 100644 --- a/clients/lcdproc/main.c +++ b/clients/lcdproc/main.c @@ -278,7 +278,7 @@ fprintf(stderr, "%s%s\n", (state) ? "" : "!", name); // Connect to the server... usleep(500000); // wait for the server to start up sock = sock_connect(server, port); - if (sock <= 0) { + if (sock < 0) { fprintf(stderr, "Error connecting to LCD server %s on port %d.\n" "Check to see that the server is running and operating normally.\n", server, port); diff --git a/clients/lcdvc/lcd_link.c b/clients/lcdvc/lcd_link.c index a72b09c..8b7b2f1 100644 --- a/clients/lcdvc/lcd_link.c +++ b/clients/lcdvc/lcd_link.c @@ -41,7 +41,7 @@ int connect_and_setup() report(RPT_INFO, "Connecting to %s:%d", address, port); sock = sock_connect(address, port); - if (sock <= 0) { + if (sock < 0) { report(RPT_ERR, "Connecting to %s:%d failed", address, port); return -1; } diff --git a/shared/sockets.c b/shared/sockets.c index 8d3645c..0a5dd57 100644 --- a/shared/sockets.c +++ b/shared/sockets.c @@ -82,7 +82,7 @@ sock_connect (char *host, unsigned short int port) #endif report (RPT_ERR, "sock_connect: connect failed"); shutdown (sock, SHUT_RDWR); - return 0; // Normal exit if server doesn't exist... + return -1; } #ifndef WINSOCK2