summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorRob Landley2006-07-16 18:58:18 +0000
committerRob Landley2006-07-16 18:58:18 +0000
commit62103757efc2b22355a96bfd1298e1dbcb217f7f (patch)
tree0bb4b7846c18aba6f104fe32b0e256c48317fe31 /loginutils
parentd893b120bae5a9bdef4cfda2df5e62867d6b1cd0 (diff)
downloadbusybox-62103757efc2b22355a96bfd1298e1dbcb217f7f.zip
busybox-62103757efc2b22355a96bfd1298e1dbcb217f7f.tar.gz
Bugfix from Tito to make sure /etc/group gets updated.
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/adduser.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index a0d4872..a640ece 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -96,6 +96,7 @@ static void passwd_wrapper(const char *login)
static int adduser(struct passwd *p, unsigned long flags)
{
FILE *file;
+ int addgroup = !p->pw_gid;
/* make sure everything is kosher and setup uid && gid */
file = bb_xfopen(bb_path_passwd_file, "a");
@@ -132,9 +133,8 @@ static int adduser(struct passwd *p, unsigned long flags)
/* add to group */
/* addgroup should be responsible for dealing w/ gshadow */
/* if using a pre-existing group, don't create one */
- if (p->pw_gid == 0) {
- addgroup_wrapper(p);
- }
+ if (addgroup) addgroup_wrapper(p);
+
/* Clear the umask for this process so it doesn't
* * screw up the permissions on the mkdir and chown. */
umask(0);