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