Reset errno = 0 before parseWholeNumber calls and errno == ERANGE checks

This commit is contained in:
Rangi
2026-07-07 17:02:46 -04:00
parent 30fd4514dc
commit ed8e3e4d02
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -267,6 +267,7 @@ static void parseArg(int ch, char *arg) {
}
case 'r':
errno = 0;
if (std::optional<uint64_t> maxDepth = parseWholeNumber(arg); !maxDepth) {
fatal("Invalid argument for option '-r'");
} else if (errno == ERANGE) {
+1
View File
@@ -105,6 +105,7 @@ void opt_Parse(char const *s) {
break;
case 'r':
errno = 0;
if (std::optional<uint64_t> maxRecursionDepth = parseWholeNumber(s); !maxRecursionDepth) {
error("Invalid argument for option 'r'");
} else if (errno == ERANGE) {