aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-26 16:31:01 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-26 16:31:01 +0000
commit40c74e75a0139de991873f099aa350509955cf06 (patch)
tree52fa81231c3fafd4ddfb1eecb9d4a62ad5401908
parent566d62702de54434650edfc7cd74c8fdef228a96 (diff)
downloadbusybox-w32-40c74e75a0139de991873f099aa350509955cf06.tar.gz
busybox-w32-40c74e75a0139de991873f099aa350509955cf06.tar.bz2
busybox-w32-40c74e75a0139de991873f099aa350509955cf06.zip
login: fix getopt_ulflags fallout (wasn't taking username supplied by getty)
git-svn-id: svn://busybox.net/trunk/busybox@16228 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--loginutils/login.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index 0157bace8..1b13fa0cc 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -235,13 +235,13 @@ int login_main(int argc, char **argv)
235 alarm(TIMEOUT); 235 alarm(TIMEOUT);
236 236
237 opt = bb_getopt_ulflags(argc, argv, "f:h:p", &opt_user, &opt_host); 237 opt = bb_getopt_ulflags(argc, argv, "f:h:p", &opt_user, &opt_host);
238
239 if (opt & LOGIN_OPT_f) { 238 if (opt & LOGIN_OPT_f) {
240 if (!amroot) 239 if (!amroot)
241 bb_error_msg_and_die("-f is for root only"); 240 bb_error_msg_and_die("-f is for root only");
242 safe_strncpy(username, opt_user, strlen(opt_user)); 241 safe_strncpy(username, opt_user, sizeof(username));
243 } 242 }
244 username[USERNAME_SIZE] = 0; 243 if (optind < argc) /* user from command line (getty) */
244 safe_strncpy(username, argv[optind], sizeof(username));
245 245
246 /* Let's find out and memorize our tty */ 246 /* Let's find out and memorize our tty */
247 if (!isatty(0) || !isatty(1) || !isatty(2)) 247 if (!isatty(0) || !isatty(1) || !isatty(2))