summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2000-01-09 05:38:47 +0000
committerjason <jason@openbsd.org>2000-01-09 05:38:47 +0000
commitf69c2b46a536c19e3aff4778e79c95599a305b90 (patch)
treee47978c1800cec12e38a93be7bfe9edf4050373b
parentSwitch to the terminfo/termcap master file from the ncurses distro (diff)
downloadwireguard-openbsd-f69c2b46a536c19e3aff4778e79c95599a305b90.tar.xz
wireguard-openbsd-f69c2b46a536c19e3aff4778e79c95599a305b90.zip
remove O_NONBLOCK from tty fd so we don't spin with EAGAIN
-rw-r--r--usr.bin/tip/tip.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
index 8da489aaed3..0944a58b6f1 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.c,v 1.9 1998/07/12 05:27:04 todd Exp $ */
+/* $OpenBSD: tip.c,v 1.10 2000/01/09 05:38:47 jason Exp $ */
/* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: tip.c,v 1.9 1998/07/12 05:27:04 todd Exp $";
+static char rcsid[] = "$OpenBSD: tip.c,v 1.10 2000/01/09 05:38:47 jason Exp $";
#endif /* not lint */
/*
@@ -208,6 +208,17 @@ cucommon:
* the "cu" version of tip.
*/
+ i = fcntl(FD, F_GETFL);
+ if (i == -1) {
+ perror("fcntl");
+ cleanup();
+ }
+ i = fcntl(FD, F_SETFL, i & ~O_NONBLOCK);
+ if (i == -1) {
+ perror("fcntl");
+ cleanup();
+ }
+
tcgetattr(0, &defterm);
term = defterm;
term.c_lflag &= ~(ICANON|IEXTEN|ECHO);