The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6ddb10cf6b7f870d749e96d2ae55976b18896f54

commit 6ddb10cf6b7f870d749e96d2ae55976b18896f54
Author:     Colin Percival <[email protected]>
AuthorDate: 2026-08-29 20:22:15 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2026-08-31 19:13:52 +0000

    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:  4fe8c1b67be0 ("Add error and range checking ... ")
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D59270
---
 usr.sbin/gstat/gstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c
index 2b991788cd9e..44e5689733ad 100644
--- a/usr.sbin/gstat/gstat.c
+++ b/usr.sbin/gstat/gstat.c
@@ -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) {

Reply via email to