summaryrefslogtreecommitdiff
path: root/init.cfg
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-04-05 11:34:42 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-04-05 11:35:35 -0700
commit937388c3059d321797ac327452d71494fcebc655 (patch)
tree2c929cde39f6e104525a4fe84ff6120b3cade08e /init.cfg
parent4c85c757e55c1b75635672624632e3e6c92c5dd1 (diff)
downloadcoreutils-937388c3059d321797ac327452d71494fcebc655.tar.gz
tty: handle misconfigured namespaces
On some platforms, isatty succeeds but ttyname fails. POSIX does not seem to allow this, but there it is. Problem reported by Christian Brauner (Bug#26371). While we’re at it, check for errors more carefully and return a new exit status 4 if stdin is closed or a similar error occurs. * doc/coreutils.texi (tty invocation): Document new behavior. * init.cfg (stderr_fileno_): Don't assume have_input_tty is not in the environment. * src/tty.c (TTY_STDIN_ERROR): New constant. (main): Exit with nonzero status if there is a usage error, like other coreutils programs. Check for error in getting stdin type. * tests/misc/tty.sh: New file. * tests/local.mk (all_tests): Add it.
Diffstat (limited to 'init.cfg')
-rw-r--r--init.cfg1
1 files changed, 1 insertions, 0 deletions
diff --git a/init.cfg b/init.cfg
index 2f747a349..af6b58175 100644
--- a/init.cfg
+++ b/init.cfg
@@ -293,6 +293,7 @@ require_setfacl_()
# Require a controlling input 'terminal'.
require_controlling_input_terminal_()
{
+ have_input_tty=yes
tty -s || have_input_tty=no
test -t 0 || have_input_tty=no
if test "$have_input_tty" = no; then