mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
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:
1 parent
4dcb33ebc8
commit
6ddb10cf6b
1 file changed
+1
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user