fix sock_connect() to return -1 on all errors (Frederick Nacino)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user