summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-02-05 12:53:39 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-02-05 12:53:39 +0000
commit7f6f3ee2476ed351de6ea89734af2314d6ce9548 (patch)
treef3bae0a17e15fb2f73c6536b1ea6f235a1369026 /usr.bin/mg
parent0842a0a2d72767680290b175c20ac65f3c6e00ad (diff)
prevent the "ttflush write failed" panic when resizing using a window
manager that that continously sends resize events. fix inspired by an older diff for vi (r1.15 of src/usr.bin/vi/cl/cl_screen.c) ok otto@ jasper@
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/ttyio.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c
index d47b7d6c8b2..228a370c5a8 100644
--- a/usr.bin/mg/ttyio.c
+++ b/usr.bin/mg/ttyio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyio.c,v 1.31 2006/04/03 05:03:34 deraadt Exp $ */
+/* $OpenBSD: ttyio.c,v 1.32 2008/02/05 12:53:38 reyk Exp $ */
/* This file is in the public domain. */
@@ -145,8 +145,11 @@ ttflush(void)
return;
while ((written = write(fileno(stdout), buf, nobuf)) != nobuf) {
- if (written == -1)
+ if (written == -1) {
+ if (errno == EINTR)
+ continue;
panic("ttflush write failed");
+ }
buf += written;
nobuf -= written;
}