From 3ef70d43adfa3eb0f74fefd72d05578b3e332b76 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 26 Dec 2006 17:37:38 +0000 Subject: adduser: trivial code movement --- Config.in | 2 +- examples/udhcp/udhcpd.conf | 2 +- loginutils/adduser.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Config.in b/Config.in index a4d442dd8..acdecccab 100644 --- a/Config.in +++ b/Config.in @@ -441,7 +441,7 @@ config INSTALL_APPLET_DONT prompt "not installed" depends on FEATURE_INSTALLER || FEATURE_SH_STANDALONE_SHELL help - Do not install applets links. Usefull when using the -install feature + Do not install applet links. Useful when using the -install feature or a standalone shell for rescue pruposes. endchoice diff --git a/examples/udhcp/udhcpd.conf b/examples/udhcp/udhcpd.conf index f91fddebf..34e47f788 100644 --- a/examples/udhcp/udhcpd.conf +++ b/examples/udhcp/udhcpd.conf @@ -67,7 +67,7 @@ interface eth0 #default: eth0 #notify_file #default: (no script) -#notify_file dumpleases # <--- usefull for debugging +#notify_file dumpleases # <--- useful for debugging # The following are bootp specific options, setable by udhcpd. 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 */ -- cgit v1.2.3