[git commit] adduser: better logic for choosing addgroup -g/--gid

Denys Vlasenko vda.linux at googlemail.com
Sat May 21 19:32:40 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=9b90d9b503c7be343ae26ce7f834b1865ab66013
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 loginutils/adduser.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 0e06ab2..47c674b 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -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);
-- 
1.7.3.4



More information about the busybox-cvs mailing list