[klibc] [PATCH] isatty(): use TCGETS instead of TIOCGPGRP, like dietlibc does
Thorsten Glaser
tg at mirbsd.org
Wed Jun 11 01:02:14 PDT 2014
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).
Reported-by: Dominik George <d.george at tarent.de>
Signed-off-by: Thorsten Glaser <t.glaser at tarent.de>
---
usr/klibc/isatty.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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);
}
--
2.0.0
More information about the klibc
mailing list