From cd8143209fa965adbcbdaca1036317969af27846 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 7 Sep 2023 00:45:30 +0200 Subject: shell: fix endless loop after redirection --- src/cmd/shell/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/shell/shell.c b/src/cmd/shell/shell.c index 3f33756..1387e48 100644 --- a/src/cmd/shell/shell.c +++ b/src/cmd/shell/shell.c @@ -115,7 +115,7 @@ void run_args(int argc, char **argv, struct redir *redir) { close(p[1]); for (;;) { long len = _sys_read(p[0], buf, buflen, 0); - if (len < 0) exit(0); + if (len <= 0) exit(0); fwrite(buf, 1, len, f); if (ferror(f)) exit(0); } -- cgit v1.2.3