ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit c4c1feac2a7cba8b2c5282810a30b192d0e30623
parent b6007ba92b85433ba228da38ae676d9c68aa4eb2
Author: sin <sin@2f30.org>
Date:   Tue,  3 Jun 2014 10:45:27 +0100

Check if stdin is a tty

Some indentation changes as well.

Diffstat:
Mlogin.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/login.c b/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');