Audit tty(1)

1) Be strict about number of arguments passed
2) Use a simpler logic while returning
This commit is contained in:
FRIGN
2015-02-28 19:59:34 +01:00
parent e45297a320
commit b9b28d4039
2 changed files with 5 additions and 2 deletions

5
tty.c
View File

@@ -20,8 +20,11 @@ main(int argc, char *argv[])
usage();
} ARGEND;
if (argc)
usage();
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
return tty ? 0 : 1;
return !tty;
}