From 3d64b0cc95c5957e53474c3e50f143c61a057104 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 18 Aug 2016 21:33:27 -0500 Subject: Change xgetpwnamid/xgetgrnamid to xgetuid/xgetgid returning the id number instead of a struct. This means it can return "12345" even if that user/group doesn't exist in /etc/passwd and similar. All the users were immediately dereferencing it to get pw_uid or gr_gid anyway, so just return it directly and adjust the users. This fixes things like "chown 12345:23456 filename". --- toys/posix/find.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/posix/find.c') diff --git a/toys/posix/find.c b/toys/posix/find.c index 02f7702d..86fc141f 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -398,8 +398,8 @@ static int do_find(struct dirtree *new) udl = xmalloc(sizeof(*udl)); dlist_add_nomalloc(&TT.argdata, (void *)udl); - if (*s == 'u') udl->u.uid = xgetpwnamid(ss[1])->pw_uid; - else if (*s == 'g') udl->u.gid = xgetgrnamid(ss[1])->gr_gid; + if (*s == 'u') udl->u.uid = xgetuid(ss[1]); + else if (*s == 'g') udl->u.gid = xgetgid(ss[1]); else { struct stat st; -- cgit v1.2.3