summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Glaser <tg@mirbsd.org>2014-06-11 10:02:14 +0200
committerH. Peter Anvin <hpa@zytor.com>2014-07-09 08:21:02 -0700
commit7763dd33e5b8eed4b9e3c583c02c10176fd550d3 (patch)
treeb4ff39fb18ef0ed2b921e601d5c9a6322409796e
parent6eb77ce795189d39fc0f7bc12eb8d7be11e46718 (diff)
downloadklibc-7763dd33e5b8eed4b9e3c583c02c10176fd550d3.tar.gz
[klibc] isatty(): use TCGETS instead of TIOCGPGRP, like dietlibc doesklibc-2.0.4
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>
-rw-r--r--usr/klibc/isatty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/klibc/isatty.c b/usr/klibc/isatty.c
index c2e4a4ea7fba3..2359479a82a11 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);
}