summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2008-02-05 12:53:38 +0000
committerreyk <reyk@openbsd.org>2008-02-05 12:53:38 +0000
commitd32734f69e4917a9b2c8cefa3989849350e5e9bd (patch)
treec57ff2a1d509b9cfb37903567f84a0eecca44b41
parentFix release number. (diff)
downloadwireguard-openbsd-d32734f69e4917a9b2c8cefa3989849350e5e9bd.tar.xz
wireguard-openbsd-d32734f69e4917a9b2c8cefa3989849350e5e9bd.zip
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@
-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;
}