The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3c4b3bab19ca66bbb3c53275c51d4bf863059fb2
commit 3c4b3bab19ca66bbb3c53275c51d4bf863059fb2 Author: John Baldwin <j...@freebsd.org> AuthorDate: 2025-08-07 17:48:36 +0000 Commit: John Baldwin <j...@freebsd.org> CommitDate: 2025-08-07 18:26:46 +0000 chroot: Remove always-true checks gid_t and uid_t are unsigned types, so the values are always >= 0. usr.sbin/chroot/chroot.c: In function 'resolve_group': usr.sbin/chroot/chroot.c:68:55: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits] 68 | if (errno == 0 && *endp == '\0' && (gid_t)gid >= 0 && gid <= GID_MAX) | ^~ usr.sbin/chroot/chroot.c: In function 'resolve_user': usr.sbin/chroot/chroot.c:87:55: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits] 87 | if (errno == 0 && *endp == '\0' && (uid_t)uid >= 0 && uid <= UID_MAX) | ^~ Reported by: GCC Fixes: 91eb4d2ba4de ("chroot: slightly cleanup") --- usr.sbin/chroot/chroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index 8a99a9bbf7cb..d9fb29474d87 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -65,7 +65,7 @@ resolve_group(const char *group) */ errno = 0; gid = strtoul(group, &endp, 0); - if (errno == 0 && *endp == '\0' && (gid_t)gid >= 0 && gid <= GID_MAX) + if (errno == 0 && *endp == '\0' && gid <= GID_MAX) return (gid); errx(1, "no such group '%s'", group); @@ -84,7 +84,7 @@ resolve_user(const char *user) errno = 0; uid = strtoul(user, &endp, 0); - if (errno == 0 && *endp == '\0' && (uid_t)uid >= 0 && uid <= UID_MAX) + if (errno == 0 && *endp == '\0' && uid <= UID_MAX) return (uid); errx(1, "no such user '%s'", user);