Page MenuHomeFreeBSD

gstat: Set errno = 0 before strtoul
ClosedPublic

Authored by cperciva on Aug 29 2026, 8:29 PM.
Tags
None
Referenced Files
F174997872: D59270.diff
Wed, Oct 7, 12:45 PM
F174902174: D59270.diff
Tue, Oct 6, 9:05 PM
Unknown Object (File)
Fri, Oct 2, 12:25 PM
Unknown Object (File)
Fri, Oct 2, 12:10 PM
Unknown Object (File)
Fri, Oct 2, 12:10 PM
Unknown Object (File)
Wed, Sep 30, 2:44 PM
Unknown Object (File)
Wed, Sep 30, 10:14 AM
Unknown Object (File)
Wed, Sep 30, 3:33 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 76327
Build 73210: arc lint + arc unit