diff options
author | Denis Vlasenko | 2006-09-03 17:11:34 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-09-03 17:11:34 +0000 |
commit | adff40e80d1dcfa6620b133512487b4dedda2422 (patch) | |
tree | 8d2a135177b23a6dc13947d27f4cbe07af76ec5f | |
parent | 1da6a2166621d26f84cfb9b8711ded657fdf8d37 (diff) | |
download | busybox-adff40e80d1dcfa6620b133512487b4dedda2422.zip busybox-adff40e80d1dcfa6620b133512487b4dedda2422.tar.gz |
sulogin: fix bug: -tNNN didn't work
-rw-r--r-- | loginutils/sulogin.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 921f34e..b7e3f6f 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -52,7 +52,7 @@ static void catchalarm(int ATTRIBUTE_UNUSED junk) int sulogin_main(int argc, char **argv) { char *cp; - char *device = (char *) 0; + char *device = NULL; const char *name = "root"; int timeout = 0; @@ -68,14 +68,15 @@ int sulogin_main(int argc, char **argv) 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 (argv[1][2] == '\0') { /* -t NN */ if (argc > 2) { timeout = atoi(argv[2]); if (argc > 3) { device = argv[3]; } } - } else { + } else { /* -tNNN */ + timeout = atoi(&argv[1][2]); if (argc > 2) { device = argv[2]; } @@ -87,7 +88,7 @@ int sulogin_main(int argc, char **argv) close(0); close(1); close(2); - if (open(device, O_RDWR) >= 0) { + if (open(device, O_RDWR) == 0) { dup(0); dup(0); } else { |