git: 885b0483fe2e - main - pw: simplify group lookup in usermod

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Fri, 04 Sep 2026 17:54:43 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=885b0483fe2e1afc45caaf1294b4b755d1c7abae

commit 885b0483fe2e1afc45caaf1294b4b755d1c7abae
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-09-04 17:53:26 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-09-04 17:54:39 +0000

    pw: simplify group lookup in usermod
    
    MFC After:      1 week
---
 usr.sbin/pw/pw_user.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index e8611b1323af..492c44731178 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -1701,9 +1701,7 @@ pw_user_mod(int argc, char **argv, char *arg1)
 	}
 
 	if (grname && pwd->pw_uid != 0) {
-		grp = GETGRNAM(grname);
-		if (grp == NULL)
-			grp = GETGRGID(pw_checkid(grname, GID_MAX));
+		grp = group_from_name_or_id(grname);
 		if (grp->gr_gid != pwd->pw_gid) {
 			pwd->pw_gid = grp->gr_gid;
 			edited = true;