Check if stdin is a tty
Some indentation changes as well.
This commit is contained in:
parent
b6007ba92b
commit
c4c1feac2a
5
login.c
5
login.c
@ -38,6 +38,9 @@ main(int argc, char *argv[])
|
||||
if (argc < 1)
|
||||
usage();
|
||||
|
||||
if (isatty(STDIN_FILENO) == 0)
|
||||
eprintf("stdin is not a tty\n");
|
||||
|
||||
errno = 0;
|
||||
pw = getpwnam(argv[0]);
|
||||
if (errno)
|
||||
@ -59,7 +62,7 @@ main(int argc, char *argv[])
|
||||
goto login;
|
||||
|
||||
/* Flush pending input */
|
||||
ioctl(STDIN_FILENO, TCFLSH, (void *)0);
|
||||
ioctl(STDIN_FILENO, TCFLSH, (void *)0);
|
||||
|
||||
pass = getpass("Password: ");
|
||||
putchar('\n');
|
||||
|
Loading…
Reference in New Issue
Block a user