adduser: better logic for choosing addgroup -g/--gid
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 21 May 2011 19:32:40 +0000 (21:32 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 21 May 2011 19:32:40 +0000 (21:32 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
loginutils/adduser.c

index 0e06ab2f593bb5bddfa132c7f640c9a95435437a..47c674bf4bc2aa2b6c04198c9d7986ef7736a468 100644 (file)
@@ -95,12 +95,14 @@ static void addgroup_wrapper(struct passwd *p, const char *group_name)
        } else {
                /* Add user to his own group with the first free gid
                 * found in passwd_study.
-                * We try to use --gid, not -g, because "standard" addgroup
-                * has no such short option, it has only long --gid.
                 */
-#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS
+#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS || !ENABLE_ADDGROUP
+               /* We try to use --gid, not -g, because "standard" addgroup
+                * has no short option -g, it has only long --gid.
+                */
                argv[1] = (char*)"--gid";
 #else
+               /* Breaks if system in fact does NOT use busybox addgroup */
                argv[1] = (char*)"-g";
 #endif
                argv[2] = utoa(p->pw_gid);