From 0b90de15375b643d2b21695fae3e46908e1effa6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 13 Dec 2010 14:28:38 +0100 Subject: more: exit if write to stdout errors out Signed-off-by: Denys Vlasenko --- util-linux/more.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util-linux/more.c') 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(); -- cgit v1.2.3