aboutsummaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/more.c')
-rw-r--r--util-linux/more.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 788609a08..ecac92821 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -191,6 +191,9 @@ int more_main(int argc UNUSED_PARAM, char **argv)
}
/* My small mind cannot fathom backspaces and UTF-8 */
putchar(c);
+
+ if (ferror(stdout)) /* if tty was destroyed (closed xterm, etc) */
+ goto end;
}
fclose(file);
fflush_all();