diff options
author | Denis Vlasenko | 2006-09-26 16:31:01 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-09-26 16:31:01 +0000 |
commit | 22f6dcb47c32909ca0a3d720b11df5ea86b1e76c (patch) | |
tree | 52fa81231c3fafd4ddfb1eecb9d4a62ad5401908 | |
parent | 8b8c75e6abc9283cbdbe6a76e0c4db6098f73ed8 (diff) | |
download | busybox-22f6dcb47c32909ca0a3d720b11df5ea86b1e76c.zip busybox-22f6dcb47c32909ca0a3d720b11df5ea86b1e76c.tar.gz |
login: fix getopt_ulflags fallout (wasn't taking username supplied by getty)
-rw-r--r-- | loginutils/login.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index 0157bac..1b13fa0 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -235,13 +235,13 @@ int login_main(int argc, char **argv) alarm(TIMEOUT); opt = bb_getopt_ulflags(argc, argv, "f:h:p", &opt_user, &opt_host); - if (opt & LOGIN_OPT_f) { if (!amroot) bb_error_msg_and_die("-f is for root only"); - safe_strncpy(username, opt_user, strlen(opt_user)); + safe_strncpy(username, opt_user, sizeof(username)); } - username[USERNAME_SIZE] = 0; + if (optind < argc) /* user from command line (getty) */ + safe_strncpy(username, argv[optind], sizeof(username)); /* Let's find out and memorize our tty */ if (!isatty(0) || !isatty(1) || !isatty(2)) |