]> git.meshlink.io Git - utcp/blobdiff - test.c
Use '== -1' to check for errors from functions.
[utcp] / test.c
diff --git a/test.c b/test.c
index fcf0c794883e1f4e6fe06d6700c9a158e629f1f6..75fce79dfd16d8697f32544a5e0a64c98e448aed 100644 (file)
--- a/test.c
+++ b/test.c
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
                return 1;
 
        int s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-       if(s < 0)
+       if(s == -1)
                return 1;
 
        if(server) {
@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) {
        struct timeval timeout = utcp_timeout(u);
 
        while(dir) {
-               size_t max = utcp_get_sndbuf_free(c);
+               size_t max = c ? utcp_get_sndbuf_free(c) : 0;
                if(max > sizeof buf)
                        max = sizeof buf;
 
@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
                                dir &= ~1;
                                if(c)
                                        utcp_shutdown(c, SHUT_WR);
-                               if(len < 0)
+                               if(len == -1)
                                        break;
                                else
                                        continue;