]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
silence coverity warnings
authorMark Andrews <marka@isc.org>
Thu, 11 Apr 2013 07:07:50 +0000 (17:07 +1000)
committerMark Andrews <marka@isc.org>
Thu, 11 Apr 2013 07:27:59 +0000 (17:27 +1000)
(cherry picked from commit 45b727f651aba2cbd2f9db51ccfb4b541520a5de)
(cherry picked from commit 53f675154c93b9e8d4e96deeee6cc4669ef40582)

bin/tests/db_test.c
bin/tests/shutdown_test.c
bin/tests/sock_test.c
bin/tests/task_test.c
bin/tests/timer_test.c

index b367eeba84b848354f49f4f2cb50911d05d2d05e..0f7c64d0cf48eefd5256b21235eeb1b2e39616ce 100644 (file)
@@ -613,10 +613,11 @@ main(int argc, char *argv[]) {
                } else if (strstr(s, "!V") == s) {
                        DBI_CHECK(dbi);
                        v = atoi(&s[2]);
-                       if (v >= dbi->rcount) {
+                       if (v >= dbi->rcount || v < 0) {
                                printf("unknown open version %d\n", v);
                                continue;
-                       } else if (dbi->rversions[v] == NULL) {
+                       }
+                       if (dbi->rversions[v] == NULL) {
                                printf("version %d is not open\n", v);
                                continue;
                        }
index 7ccce808519e4099a91c15c4d15ef7ebe9f82dd0..0dcf3b82c9ad4eaff6550576db017ec266fd9921 100644 (file)
@@ -174,9 +174,13 @@ main(int argc, char *argv[]) {
 
        RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
 
-       if (argc > 1)
+       if (argc > 1) {
                workers = atoi(argv[1]);
-       else
+               if (workers < 1)
+                       workers = 1;
+               if (workers > 8192)
+                       workers = 8192;
+       } else
                workers = 2;
        printf("%d workers\n", workers);
 
index 8f33a7ed494673722e220d7a6d98b3bd5413fa7b..f6d2a39222e86a344226859862b03cd57b7aeacd 100644 (file)
@@ -263,9 +263,13 @@ main(int argc, char *argv[]) {
        isc_result_t result;
        int pf;
 
-       if (argc > 1)
+       if (argc > 1) {
                workers = atoi(argv[1]);
-       else
+               if (workers < 1)
+                       workers = 1;
+               if (workers > 8192)
+                       workers = 8192;
+       } else
                workers = 2;
        printf("%d workers\n", workers);
 
index e3ff26b56c991555ee6082a882e169db6a1c323f..2e162b6d1e946ae95f96222e3cdc99d5941a192f 100644 (file)
@@ -69,9 +69,13 @@ main(int argc, char *argv[]) {
        isc_timer_t *ti1, *ti2;
        struct isc_interval interval;
 
-       if (argc > 1)
+       if (argc > 1) {
                workers = atoi(argv[1]);
-       else
+               if (workers < 1)
+                       workers = 1;
+               if (workers > 8192)
+                       workers = 8192;
+       } else
                workers = 2;
        printf("%d workers\n", workers);
 
index 2825dc58e90283db169b528ddfe4587e0e6f67ca..cb5459ccf2102636431e0b1c3213193c1e69739b 100644 (file)
@@ -102,9 +102,13 @@ main(int argc, char *argv[]) {
        isc_time_t expires, now;
        isc_interval_t interval;
 
-       if (argc > 1)
+       if (argc > 1) {
                workers = atoi(argv[1]);
-       else
+               if (workers < 1)
+                       workers = 1;
+               if (workers > 8192)
+                       workers = 8192;
+       } else
                workers = 2;
        printf("%d workers\n", workers);