summaryrefslogtreecommitdiffstats
path: root/usr.bin/id
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-08-28 10:23:58 +0000
committerdg <dg@FreeBSD.org>1995-08-28 10:23:58 +0000
commit3d1e990fe45331f764c677434a5ee4f563eae713 (patch)
tree4b1a8b192b121a115f41f0e0673b77f635f53f48 /usr.bin/id
parentebb726ec45c12268b6b931aa636809cc9cb99a90 (diff)
downloadFreeBSD-src-3d1e990fe45331f764c677434a5ee4f563eae713.zip
FreeBSD-src-3d1e990fe45331f764c677434a5ee4f563eae713.tar.gz
Fixed bug where 'id <user>' output the wrong group name (the user name
was output instead). Pointed out by Chael Hall <nowhere@chaos.taylored.com>.
Diffstat (limited to 'usr.bin/id')
-rw-r--r--usr.bin/id/id.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
index 9b306ce..61cae11 100644
--- a/usr.bin/id/id.c
+++ b/usr.bin/id/id.c
@@ -231,24 +231,24 @@ user(pw)
{
register struct group *gr;
register char *fmt, **p;
- int cnt, id, lastid, ngroups, groups[NGROUPS + 1];
+ int cnt, gid, lastgid, ngroups, groups[NGROUPS + 1];
- id = pw->pw_uid;
- (void)printf("uid=%u(%s)", id, pw->pw_name);
- (void)printf(" gid=%u", pw->pw_gid);
- if (gr = getgrgid(id))
+ (void)printf("uid=%u(%s)", pw->pw_uid, pw->pw_name);
+ gid = pw->pw_gid;
+ (void)printf(" gid=%u", gid);
+ if (gr = getgrgid(gid))
(void)printf("(%s)", gr->gr_name);
ngroups = NGROUPS + 1;
- (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
+ (void) getgrouplist(pw->pw_name, gid, groups, &ngroups);
fmt = " groups=%u";
- for (lastid = -1, cnt = 0; cnt < ngroups; ++cnt) {
- if (lastid == (id = groups[cnt]))
+ for (lastgid = -1, cnt = 0; cnt < ngroups; ++cnt) {
+ if (lastgid == (gid = groups[cnt]))
continue;
- (void)printf(fmt, id);
+ (void)printf(fmt, gid);
fmt = " %u";
- if (gr = getgrgid(id))
+ if (gr = getgrgid(gid))
(void)printf("(%s)", gr->gr_name);
- lastid = id;
+ lastgid = gid;
}
(void)printf("\n");
}
OpenPOWER on IntegriCloud