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/other/makedevs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/other/makedevs.c') diff --git a/toys/other/makedevs.c b/toys/other/makedevs.c index ed91fd93..5e6a9822 100644 --- a/toys/other/makedevs.c +++ b/toys/other/makedevs.c @@ -78,8 +78,8 @@ void makedevs_main() continue; } else mode |= (mode_t[]){S_IFIFO, S_IFCHR, S_IFBLK, 0, 0}[i]; - uid = *user ? xgetpwnamid(user)->pw_uid : getuid(); - gid = *group ? xgetgrnamid(group)->gr_gid : getgid(); + uid = *user ? xgetuid(user) : getuid(); + gid = *group ? xgetgid(group) : getgid(); while (*node == '/') node++; // using relative path -- cgit v1.2.3