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)
|
if (argc < 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
if (isatty(STDIN_FILENO) == 0)
|
||||||
|
eprintf("stdin is not a tty\n");
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pw = getpwnam(argv[0]);
|
pw = getpwnam(argv[0]);
|
||||||
if (errno)
|
if (errno)
|
||||||
@ -59,7 +62,7 @@ main(int argc, char *argv[])
|
|||||||
goto login;
|
goto login;
|
||||||
|
|
||||||
/* Flush pending input */
|
/* Flush pending input */
|
||||||
ioctl(STDIN_FILENO, TCFLSH, (void *)0);
|
ioctl(STDIN_FILENO, TCFLSH, (void *)0);
|
||||||
|
|
||||||
pass = getpass("Password: ");
|
pass = getpass("Password: ");
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
Loading…
Reference in New Issue
Block a user