ash: builtin: Mark more regular built-ins
[oweals/busybox.git] / loginutils / adduser.c
index 8b92df9234805db134db8cd7bc7ceb380e00a66f..d3c795afa48bec5306c475b510c9cd02680ed4e2 100644 (file)
@@ -159,7 +159,7 @@ static void passwd_wrapper(const char *login_name) NORETURN;
 static void passwd_wrapper(const char *login_name)
 {
        BB_EXECLP("passwd", "passwd", "--", login_name, NULL);
-       bb_error_msg_and_die("can't execute passwd, you must set password manually");
+       bb_simple_error_msg_and_die("can't execute passwd, you must set password manually");
 }
 
 //FIXME: upstream adduser has no short options! NOT COMPATIBLE!
@@ -193,20 +193,23 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
 
        /* got root? */
        if (geteuid()) {
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
        }
 
        pw.pw_gecos = (char *)"Linux User,,,";
        /* We assume that newly created users "inherit" root's shell setting */
-       pw.pw_shell = (char *)get_shell_name();
+       pw.pw_shell = xstrdup(get_shell_name()); /* might come from getpwnam(), need to make a copy */
        pw.pw_dir = NULL;
 
-       /* at least one and at most two non-option args */
-       /* disable interactive passwd for system accounts */
-       opt_complementary = "-1:?2:SD";
-       opts = getopt32long(argv, "h:g:s:G:DSHu:k:", adduser_longopts,
+       opts = getopt32long(argv, "^"
+                       "h:g:s:G:DSHu:k:"
+                       /* at least one and at most two non-option args */
+                       /* disable interactive passwd for system accounts */
+                       "\0" "-1:?2:SD",
+                       adduser_longopts,
                        &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell,
-                       &usegroup, &uid, &skel);
+                       &usegroup, &uid, &skel
+       );
        if (opts & OPT_UID)
                pw.pw_uid = xatou_range(uid, 0, CONFIG_LAST_ID);