From 070b19e2948b3a03669b0f1888f1661b0d196275 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 15 Aug 2023 19:23:58 +0200 Subject: user: fix freeze if graphical shell was quit --- src/cmd/init/driver/termcook.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/cmd/init/driver/termcook.c') 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 +#include +#include #include #include #include @@ -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) { -- cgit v1.2.3