Bugfix from Tito to make sure /etc/group gets updated.

This commit is contained in:
Rob Landley 2006-07-16 18:58:18 +00:00
parent d893b120ba
commit 62103757ef

View File

@ -96,6 +96,7 @@ static void passwd_wrapper(const char *login)
static int adduser(struct passwd *p, unsigned long flags) static int adduser(struct passwd *p, unsigned long flags)
{ {
FILE *file; FILE *file;
int addgroup = !p->pw_gid;
/* make sure everything is kosher and setup uid && gid */ /* make sure everything is kosher and setup uid && gid */
file = bb_xfopen(bb_path_passwd_file, "a"); file = bb_xfopen(bb_path_passwd_file, "a");
@ -132,9 +133,8 @@ static int adduser(struct passwd *p, unsigned long flags)
/* add to group */ /* add to group */
/* addgroup should be responsible for dealing w/ gshadow */ /* addgroup should be responsible for dealing w/ gshadow */
/* if using a pre-existing group, don't create one */ /* if using a pre-existing group, don't create one */
if (p->pw_gid == 0) { if (addgroup) addgroup_wrapper(p);
addgroup_wrapper(p);
}
/* Clear the umask for this process so it doesn't /* Clear the umask for this process so it doesn't
* * screw up the permissions on the mkdir and chown. */ * * screw up the permissions on the mkdir and chown. */
umask(0); umask(0);