src: Set errno = 0 before calling strtol
This commit is contained in:
parent
67d4cb6367
commit
68b5204f29
|
@ -411,6 +411,7 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
case 's':
|
||||
/* --table-size */
|
||||
errno = 0;
|
||||
config.table_size = strtoul(optarg, &end, 10);
|
||||
if(errno == ERANGE || *end != '\0') {
|
||||
fprintf(stderr, "-s: Bad option value\n");
|
||||
|
@ -419,6 +420,7 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
case 'S':
|
||||
/* --deflate-table-size */
|
||||
errno = 0;
|
||||
config.deflate_table_size = strtoul(optarg, &end, 10);
|
||||
if(errno == ERANGE || *end != '\0') {
|
||||
fprintf(stderr, "-S: Bad option value\n");
|
||||
|
|
|
@ -269,6 +269,7 @@ int main(int argc, char **argv)
|
|||
exit(EXIT_SUCCESS);
|
||||
case 's':
|
||||
/* --table-size */
|
||||
errno = 0;
|
||||
config.table_size = strtoul(optarg, &end, 10);
|
||||
if(errno == ERANGE || *end != '\0') {
|
||||
fprintf(stderr, "-s: Bad option value\n");
|
||||
|
|
|
@ -1837,6 +1837,7 @@ int main(int argc, char **argv)
|
|||
config.multiply = strtoul(optarg, nullptr, 10);
|
||||
break;
|
||||
case 'c':
|
||||
errno = 0;
|
||||
config.header_table_size = strtol(optarg, &end, 10);
|
||||
if(errno == ERANGE || *end != '\0') {
|
||||
std::cerr << "-c: Bad option value: " << optarg << std::endl;
|
||||
|
|
|
@ -167,6 +167,7 @@ int main(int argc, char **argv)
|
|||
config.verbose = true;
|
||||
break;
|
||||
case 'c':
|
||||
errno = 0;
|
||||
config.header_table_size = strtol(optarg, &end, 10);
|
||||
if(errno == ERANGE || *end != '\0') {
|
||||
std::cerr << "-c: Bad option value: " << optarg << std::endl;
|
||||
|
|
Loading…
Reference in New Issue