summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ovsdb.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
index 793220400..4b216fe74 100644
--- a/tests/test-ovsdb.c
+++ b/tests/test-ovsdb.c
@@ -96,7 +96,7 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt)
char *short_options = ovs_cmdl_long_options_to_short_options(long_options);
for (;;) {
- unsigned long int timeout;
+ unsigned int timeout = 0;
int c;
c = getopt_long(argc, argv, short_options, long_options, NULL);
@@ -106,10 +106,8 @@ parse_options(int argc, char *argv[], struct test_ovsdb_pvt_context *pvt)
switch (c) {
case 't':
- timeout = strtoul(optarg, NULL, 10);
- if (timeout <= 0) {
- ovs_fatal(0, "value %s on -t or --timeout is not at least 1",
- optarg);
+ if (!str_to_uint(optarg, 10, &timeout) || !timeout) {
+ ovs_fatal(0, "value %s on -t or --timeout is invalid", optarg);
} else {
time_alarm(timeout);
}