diff options
-rw-r--r-- | loginutils/adduser.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index a0d4872ec..a640ece3b 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -96,6 +96,7 @@ static void passwd_wrapper(const char *login) | |||
96 | static int adduser(struct passwd *p, unsigned long flags) | 96 | static int adduser(struct passwd *p, unsigned long flags) |
97 | { | 97 | { |
98 | FILE *file; | 98 | FILE *file; |
99 | int addgroup = !p->pw_gid; | ||
99 | 100 | ||
100 | /* make sure everything is kosher and setup uid && gid */ | 101 | /* make sure everything is kosher and setup uid && gid */ |
101 | file = bb_xfopen(bb_path_passwd_file, "a"); | 102 | file = bb_xfopen(bb_path_passwd_file, "a"); |
@@ -132,9 +133,8 @@ static int adduser(struct passwd *p, unsigned long flags) | |||
132 | /* add to group */ | 133 | /* add to group */ |
133 | /* addgroup should be responsible for dealing w/ gshadow */ | 134 | /* addgroup should be responsible for dealing w/ gshadow */ |
134 | /* if using a pre-existing group, don't create one */ | 135 | /* if using a pre-existing group, don't create one */ |
135 | if (p->pw_gid == 0) { | 136 | if (addgroup) addgroup_wrapper(p); |
136 | addgroup_wrapper(p); | 137 | |
137 | } | ||
138 | /* Clear the umask for this process so it doesn't | 138 | /* Clear the umask for this process so it doesn't |
139 | * * screw up the permissions on the mkdir and chown. */ | 139 | * * screw up the permissions on the mkdir and chown. */ |
140 | umask(0); | 140 | umask(0); |