diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-21 00:02:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-21 00:02:06 +0000 |
commit | 873353c43ad6796218ad86aca7f8a65b52e0fa79 (patch) | |
tree | 3fed63ccedb1afe999db50a439e0aa0c1f14471d /usr.bin/mg/ttyio.c | |
parent | f3632d32060be851c53e0a52a1e6919e3fedd031 (diff) |
signal-safe window size changing
Diffstat (limited to 'usr.bin/mg/ttyio.c')
-rw-r--r-- | usr.bin/mg/ttyio.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c index 311120d6096..01d375c3fc4 100644 --- a/usr.bin/mg/ttyio.c +++ b/usr.bin/mg/ttyio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyio.c,v 1.17 2002/01/10 12:13:35 art Exp $ */ +/* $OpenBSD: ttyio.c,v 1.18 2002/02/21 00:02:05 deraadt Exp $ */ /* * POSIX terminal I/O. @@ -154,9 +154,18 @@ int ttgetc() { char c; - - while (read(0, &c, 1) != 1) - ; + int ret; + + do { + ret = read(0, &c, 1); + if (ret == -1 && errno == EINTR) { + if (winch_flag) { + refresh(0, 0); + winch_flag = 0; + } + } else if (ret == 1) + break; + } while (1); return ((int) c); } |