aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-26 16:31:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-26 16:31:01 +0000
commit22f6dcb47c32909ca0a3d720b11df5ea86b1e76c (patch)
tree52fa81231c3fafd4ddfb1eecb9d4a62ad5401908
parent8b8c75e6abc9283cbdbe6a76e0c4db6098f73ed8 (diff)
downloadbusybox-w32-22f6dcb47c32909ca0a3d720b11df5ea86b1e76c.tar.gz
busybox-w32-22f6dcb47c32909ca0a3d720b11df5ea86b1e76c.tar.bz2
busybox-w32-22f6dcb47c32909ca0a3d720b11df5ea86b1e76c.zip
login: fix getopt_ulflags fallout (wasn't taking username supplied by getty)
-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))