Browse Source

CID 69145 - Argument cannot be negative in unit-test-server

Stéphane Raimbault 8 years ago
parent
commit
3053bd0adb
1 changed files with 4 additions and 0 deletions
  1. 4 0
      tests/unit-test-server.c

+ 4 - 0
tests/unit-test-server.c

@@ -161,6 +161,10 @@ int main(int argc, char*argv[])
                 uint8_t req[] = "\x00\x1C\x00\x00\x00\x05\xFF\x03\x02\x00\x00";
                 int req_length = 11;
                 int w_s = modbus_get_socket(ctx);
+                if (ws_s == -1) {
+                    fprintf(stderr, "Unable to get a valid socket in special test\n");
+                    continue;
+                }
 
                 /* Copy TID */
                 req[1] = query[1];