From f42a3165e8b527a81865870f74865c1cd99b7196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 26 Nov 2016 17:19:04 +0100 Subject: vis: re-open /dev/tty read-writeable libtermkey's initialization routine tries to write to the underlying file descriptor which fails with EBADF if it is opened read only. This was a problem in the terminal restore code called after a shell command is executed. It should fix the following: $ echo foo | vis - > bar :!/bin/sh exit where before vis would no longer accept any input. --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 1b6f14d..7bab3cd 100644 --- a/main.c +++ b/main.c @@ -2280,7 +2280,7 @@ int main(int argc, char *argv[]) { if (len == -1) vis_die(vis, "Can not read from stdin\n"); text_snapshot(txt); - int fd = open("/dev/tty", O_RDONLY); + int fd = open("/dev/tty", O_RDWR); if (fd == -1) vis_die(vis, "Can not reopen stdin\n"); dup2(fd, STDIN_FILENO); -- cgit v1.2.3