aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-05-21 21:32:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-21 21:32:40 +0200
commit9b90d9b503c7be343ae26ce7f834b1865ab66013 (patch)
tree0fab15423e3220d9790066422306f43b90d5338e
parent569e930768922812ce5169a3058b65fff9196308 (diff)
downloadbusybox-w32-9b90d9b503c7be343ae26ce7f834b1865ab66013.tar.gz
busybox-w32-9b90d9b503c7be343ae26ce7f834b1865ab66013.tar.bz2
busybox-w32-9b90d9b503c7be343ae26ce7f834b1865ab66013.zip
adduser: better logic for choosing addgroup -g/--gid
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--loginutils/adduser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 0e06ab2f5..47c674bf4 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -95,12 +95,14 @@ static void addgroup_wrapper(struct passwd *p, const char *group_name)
95 } else { 95 } else {
96 /* Add user to his own group with the first free gid 96 /* Add user to his own group with the first free gid
97 * found in passwd_study. 97 * found in passwd_study.
98 * We try to use --gid, not -g, because "standard" addgroup
99 * has no such short option, it has only long --gid.
100 */ 98 */
101#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS 99#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS || !ENABLE_ADDGROUP
100 /* We try to use --gid, not -g, because "standard" addgroup
101 * has no short option -g, it has only long --gid.
102 */
102 argv[1] = (char*)"--gid"; 103 argv[1] = (char*)"--gid";
103#else 104#else
105 /* Breaks if system in fact does NOT use busybox addgroup */
104 argv[1] = (char*)"-g"; 106 argv[1] = (char*)"-g";
105#endif 107#endif
106 argv[2] = utoa(p->pw_gid); 108 argv[2] = utoa(p->pw_gid);