diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-26 17:37:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-26 17:37:38 +0000 |
commit | 3ef70d43adfa3eb0f74fefd72d05578b3e332b76 (patch) | |
tree | da5995d46e8f5505cf0af5d3049087f7d7cf5d16 /loginutils | |
parent | bf0a201008671f81c107de72c026b1b84967561d (diff) | |
download | busybox-3ef70d43adfa3eb0f74fefd72d05578b3e332b76.tar.gz |
adduser: trivial code movement
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/adduser.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 44516ef5a..418d4c785 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c @@ -164,6 +164,11 @@ int adduser_main(int argc, char **argv) const char *usegroup = NULL; unsigned long flags; + /* got root? */ + if (geteuid()) { + bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); + } + pw.pw_gecos = "Linux User,,,"; pw.pw_shell = (char *)DEFAULT_SHELL; pw.pw_dir = NULL; @@ -172,15 +177,10 @@ int adduser_main(int argc, char **argv) opt_complementary = "-1:?1:?"; flags = getopt32(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); - /* got root? */ - if(geteuid()) { - bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); - } - /* create string for $HOME if not specified already */ if (!pw.pw_dir) { snprintf(bb_common_bufsiz1, BUFSIZ, "/home/%s", argv[optind]); - pw.pw_dir = &bb_common_bufsiz1[0]; + pw.pw_dir = bb_common_bufsiz1; } /* create a passwd struct */ |