From cbfa26f7e52b1ee95f1b5ea280e7d2e394c03d0b Mon Sep 17 00:00:00 2001 From: Carl Olof Erlandsson Date: Mon, 9 Mar 2015 11:20:41 +0100 Subject: [PATCH] Open `/dev/tty/` in read and append mode. This avoids illegal seek errors when users send input while we're outputting to the terminal. Closes #42. --- src/ui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui.c b/src/ui.c index afbd3a24..5f1309b0 100644 --- a/src/ui.c +++ b/src/ui.c @@ -66,7 +66,7 @@ void start_ui() { struct termios newattr; - if ((tty = fopen("/dev/tty", "w+")) == NULL) { + if ((tty = fopen("/dev/tty", "a+")) == NULL) { err(1, "fopen"); } tcgetattr(fileno(tty), &oldattr);