- struct passwd pwent;
- struct passwd *pwd;
- const char * const *p;
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
- struct spwd *spwd = NULL;
-#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
-
- openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
- if (argc > 1) {
- if (strncmp(argv[1], "-t", 2) == 0) {
- if (strcmp(argv[1], "-t") == 0) {
- if (argc > 2) {
- timeout = atoi(argv[2]);
- if (argc > 3) {
- device = argv[3];
- }
- }
- } else {
- if (argc > 2) {
- device = argv[2];
- }
- }
- } else {
- device = argv[1];
- }
- if (device) {
- close(0);
- close(1);
- close(2);
- if (open(device, O_RDWR) >= 0) {
- dup(0);
- dup(0);
- } else {
- syslog(LOG_WARNING, "cannot open %s\n", device);
- exit(EXIT_FAILURE);
- }
- }
- }
- if (access(bb_path_passwd_file, 0) == -1) {
- syslog(LOG_WARNING, "No password file\n");
- bb_error_msg_and_die("No password file\n");
+ opt_complementary = "t+"; /* -t N */
+ getopt32(argv, "t:", &timeout);
+ argv += optind;
+
+ if (argv[0]) {
+ close(0);
+ close(1);
+ dup(xopen(argv[0], O_RDWR));
+ close(2);
+ dup(0);