Commit 68b5204f authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

src: Set errno = 0 before calling strtol

parent 67d4cb63
......@@ -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;
......
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