[hackers] [ubase] Check if 0, 1, 2 are valid tty file descriptors || sin
commit 2d45a04b92df641158ca400873a522fede1d9a01
Author: sin <sin_AT_2f30.org>
Date: Sun Nov 30 13:04:47 2014 +0000
Check if 0, 1, 2 are valid tty file descriptors
diff --git a/login.c b/login.c
index e0930c5..45b69ea 100644
--- a/login.c
+++ b/login.c
_AT_@ -71,8 +71,8 @@ main(int argc, char *argv[])
if (argc < 1)
usage();
- if (isatty(STDIN_FILENO) == 0)
- eprintf("stdin is not a tty\n");
+ if (isatty(0) == 0 || isatty(1) == 0 || isatty(2) == 0)
+ eprintf("no tty");
user = argv[0];
errno = 0;
Received on Sun Nov 30 2014 - 14:05:29 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 30 2014 - 14:12:09 CET