[klibc] isatty(): use TCGETS instead of TIOCGPGRP, like dietlibc does
While all “real” ttys may support TIOCGPGRP, /dev/console doesn’t;
using TCGETS here allows Linux booted with init=/bin/mksh-static
to have working interactive command line (PS1, editing, etc).
[ hpa: TCGETS matches glibc, so go with it ]
Reported-by: Dominik George <d.george@tarent.de>
Signed-off-by: Thorsten Glaser <t.glaser@tarent.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/usr/klibc/isatty.c b/usr/klibc/isatty.c
index c2e4a4e..2359479 100644
--- a/usr/klibc/isatty.c
+++ b/usr/klibc/isatty.c
@@ -8,8 +8,9 @@
int isatty(int fd)
{
- int dummy;
+ struct termios dummy;
/* All ttys support TIOCGPGRP */
- return !ioctl(fd, TIOCGPGRP, &dummy);
+ /* except /dev/console which needs TCGETS */
+ return !ioctl(fd, TCGETS, &dummy);
}