gstat: Set errno = 0 before strtoul

The strtoul function sets errno on error, but does not clear it on
success; when using strtoul and checking errno (as one should) for
ERANGE / EINVAL afterwards, it's important to zero errno first.

While here, remove a dead store.

Reviewed by:	phk
Fixes:	4fe8c1b67b ("Add error and range checking ... ")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D59270
This commit is contained in:
Colin Percival committed 2026-08-31 12:13:52 -07:00
1 parent 4dcb33ebc8
commit 6ddb10cf6b
1 file changed
+1 -1
+1 -1
View File
@@ -440,7 +440,7 @@ main(int argc, char **argv)
use_gb();
break;
case 'I':
p = NULL;
errno = 0;
i = strtoul(optarg, &p, 0);
if (p == optarg || errno == EINVAL ||
errno == ERANGE) {