summaryrefslogtreecommitdiff
path: root/src/cmd/shell/shell.c
diff options
context:
space:
mode:
authordzwdz2023-09-07 00:45:30 +0200
committerdzwdz2023-09-07 00:45:30 +0200
commitcd8143209fa965adbcbdaca1036317969af27846 (patch)
treea96dd8058914d292e2b513872572ad7fed8ad8fb /src/cmd/shell/shell.c
parent8f5e8eb284430543c041b650084752a09f201b72 (diff)
shell: fix endless loop after redirection
Diffstat (limited to 'src/cmd/shell/shell.c')
-rw-r--r--src/cmd/shell/shell.c2
1 files changed, 1 insertions, 1 deletions
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);
}