diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-05 16:23:06 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-05 16:23:06 +0000 |
commit | 15437e3e2a0cc9e4ba25066fd562b2862d38799b (patch) | |
tree | 5093eddb8a8dd3ae6edd564e43f6219be3fd9a08 /loginutils/addgroup.c | |
parent | d324e1b808daca7eec5b8700824a886a21508714 (diff) | |
download | busybox-w32-15437e3e2a0cc9e4ba25066fd562b2862d38799b.tar.gz busybox-w32-15437e3e2a0cc9e4ba25066fd562b2862d38799b.tar.bz2 busybox-w32-15437e3e2a0cc9e4ba25066fd562b2862d38799b.zip |
libbb: add xgetgrnam too. ~0 code size change
Diffstat (limited to 'loginutils/addgroup.c')
-rw-r--r-- | loginutils/addgroup.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 2a840d7c0..5032d7b99 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c | |||
@@ -158,10 +158,8 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv) | |||
158 | 158 | ||
159 | /* check if group and user exist */ | 159 | /* check if group and user exist */ |
160 | xuname2uid(argv[0]); /* unknown user: exit */ | 160 | xuname2uid(argv[0]); /* unknown user: exit */ |
161 | xgroup2gid(argv[1]); /* unknown group: exit */ | 161 | gr = xgetgrnam(argv[1]); /* unknown group: exit */ |
162 | // race here! | ||
163 | /* check if user is already in this group */ | 162 | /* check if user is already in this group */ |
164 | gr = getgrnam(argv[1]); | ||
165 | for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { | 163 | for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { |
166 | if (!strcmp(argv[0], *(gr->gr_mem))) { | 164 | if (!strcmp(argv[0], *(gr->gr_mem))) { |
167 | /* user is already in group: do nothing */ | 165 | /* user is already in group: do nothing */ |