Page MenuHomeFreeBSD

gstat: Set errno = 0 before strtoul
ClosedPublic

Authored by cperciva on Aug 29 2026, 8:29 PM.
Tags
None
Referenced Files
F174073594: D59270.id.diff
Wed, Sep 30, 10:14 AM
F174036525: D59270.id185422.diff
Wed, Sep 30, 3:33 AM
Unknown Object (File)
Sat, Sep 26, 10:59 PM
Unknown Object (File)
Sat, Sep 26, 8:19 AM
Unknown Object (File)
Fri, Sep 25, 2:27 AM
Unknown Object (File)
Thu, Sep 24, 4:41 AM
Unknown Object (File)
Wed, Sep 23, 5:12 AM
Unknown Object (File)
Tue, Sep 22, 7:10 PM
Subscribers

Details

Summary

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.

Fixes: 4fe8c1b67be0 ("Add error and range checking ... ")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable