diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-11-26 17:19:04 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-11-26 17:19:04 +0100 |
| commit | f42a3165e8b527a81865870f74865c1cd99b7196 (patch) | |
| tree | 5ee1d82bb3e1a42d678f8559bfc4d3061e7e3f2f /main.c | |
| parent | ab65ab5d027e97ead372264a6ecfd3ac642299ba (diff) | |
| download | vis-f42a3165e8b527a81865870f74865c1cd99b7196.tar.gz vis-f42a3165e8b527a81865870f74865c1cd99b7196.tar.xz | |
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.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |
