diff options
author | dzwdz | 2023-08-15 19:23:58 +0200 |
---|---|---|
committer | dzwdz | 2023-08-15 19:23:58 +0200 |
commit | 070b19e2948b3a03669b0f1888f1661b0d196275 (patch) | |
tree | c006fa6b1e64e4d0927bb7ad0746d12a54f6973d /src/cmd/init/driver/termcook.c | |
parent | 642b5fb0007b64c77d186fcb018d571152ee1d47 (diff) |
user: fix freeze if graphical shell was quit
Diffstat (limited to 'src/cmd/init/driver/termcook.c')
-rw-r--r-- | src/cmd/init/driver/termcook.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/init/driver/termcook.c b/src/cmd/init/driver/termcook.c index a76f3a8..68b5746 100644 --- a/src/cmd/init/driver/termcook.c +++ b/src/cmd/init/driver/termcook.c @@ -1,5 +1,7 @@ #include "driver.h" #include <camellia/syscalls.h> +#include <err.h> +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -25,7 +27,11 @@ static void line_editor(hid_t input, hid_t output) { enum tstate state = Normal; for (;;) { int readlen = _sys_read(input, readbuf, sizeof readbuf, -1); - if (readlen < 0) return; + if (readlen < 0) { + errno = -readlen; + err(1, "read"); + return; + } for (int i = 0; i < readlen; i++) { char c = readbuf[i]; switch (state) { |