Check if 0, 1, 2 are valid tty file descriptors

This commit is contained in:
sin 2014-11-30 13:04:47 +00:00
parent 6da76775cb
commit 2d45a04b92

View File

@ -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;