summaryrefslogtreecommitdiff
path: root/loginutils/adduser.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-04 10:16:52 +0000
committerDenis Vlasenko2007-06-04 10:16:52 +0000
commit74324c86663f57a19c1de303ee8c8e5449db9ef2 (patch)
tree11f5da9de4212875ce5811be2e1050e076378c9a /loginutils/adduser.c
parent4e5f82c76f08614d0b69f9ec4a8baac303af15f6 (diff)
downloadbusybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.zip
busybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.tar.gz
Audit bb_common_bufsiz usage, add script which looks for misuse.
tr: stop using globals needlessly. code: -103 bytes
Diffstat (limited to 'loginutils/adduser.c')
-rw-r--r--loginutils/adduser.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 82a4381..916a25b 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -182,15 +182,14 @@ int adduser_main(int argc, char **argv)
/* check for min, max and missing args and exit on error */
opt_complementary = "-1:?1:?";
getopt32(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup);
+ argv += optind;
- /* create string for $HOME if not specified already */
+ /* create a passwd struct */
+ pw.pw_name = argv[0];
if (!pw.pw_dir) {
- snprintf(bb_common_bufsiz1, BUFSIZ, "/home/%s", argv[optind]);
- pw.pw_dir = bb_common_bufsiz1;
+ /* create string for $HOME if not specified already */
+ pw.pw_dir = xasprintf("/home/%s", argv[0]);
}
-
- /* create a passwd struct */
- pw.pw_name = argv[optind];
pw.pw_passwd = (char *)"x";
pw.pw_uid = 0;
pw.pw_gid = usegroup ? xgroup2gid(usegroup) : 0; /* exits on failure */