more: exit if write to stdout errors out

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2010-12-13 14:28:38 +01:00
parent 1f3709ec74
commit 0b90de1537

View File

@ -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();