Commit e8d26b28 authored by Mark Andrews's avatar Mark Andrews

error out if -m argument is invalid

parent 1c33669e
Pipeline #14268 passed with stages
in 1 minute and 11 seconds
......@@ -4023,11 +4023,15 @@ main(int argc, char **argv) {
}
exit (0);
case 'm': n = strtol(optarg, &end, 10);
if (*end == '\0' && n > 10)
if (n == 0 && *end != '\0') {
fprintf(stderr, "invalid number: %s\n", optarg);
goto usage;
}
if (n > 10)
maxoutstanding = n;
if (maxoutstanding > FD_SETSIZE - 10)
if (maxoutstanding > FD_SETSIZE - 10)
maxoutstanding = FD_SETSIZE - 10;
break;
break;
case 'n': printnsid = 1; break;
case 'o': inorder = 1; break;
case 'p': serial = 0; break;
......@@ -4053,6 +4057,7 @@ main(int argc, char **argv) {
}
break;
default:
usage:
printf("usage: genreport [-46abBcdeEfgGjLnopstT] "
"[-i test] [-I test] [-m maxoutstanding] "
"[-r server]\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment