DAFS: Do not ignore out-of-range -vhashsize
authorAndrew Deason <adeason@sinenomine.net>
Thu, 2 Sep 2010 17:56:28 +0000 (12:56 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 14 Sep 2010 08:01:35 +0000 (01:01 -0700)
If the specified -vhashsize is out of the 6-14 range, do not just
ignore it. Instead, note the error and quit.

Change-Id: I2a26443bbd3a91183435a26562bea48b8b6a1eda
Reviewed-on: http://gerrit.openafs.org/2649
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/viced/viced.c

index ce5342a..6f0c282 100644 (file)
@@ -1203,11 +1203,17 @@ ParseArgs(int argc, char *argv[])
                return -1;
            }
        } else if (!strcmp(argv[i], "-vhashsize")) {
+           int hashsize;
             if ((i + 1) >= argc) {
                fprintf(stderr, "missing argument for %s\n", argv[i]);
                return -1;
            }
-           VSetVolHashSize(atoi(argv[++i]));
+           hashsize = atoi(argv[++i]);
+           if (VSetVolHashSize(hashsize)) {
+               fprintf(stderr, "specified -vhashsize (%s) is invalid or out "
+                               "of range\n", argv[i]);
+               return -1;
+           }
        } else if (!strcmp(argv[i], "-vlrudisable")) {
            VLRU_SetOptions(VLRU_SET_ENABLED, 0);
        } else if (!strcmp(argv[i], "-vlruthresh")) {