summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-08-07 16:44:28 +0000
committerpeter <peter@FreeBSD.org>1995-08-07 16:44:28 +0000
commitc87e4ea046fafb0b07c7ac3335948b0743fed8b4 (patch)
tree7ae33f67d95d96832805966762c01906d8c079dc
parent778f67db9cacecced65fb98a330c6ad8dbc73454 (diff)
downloadFreeBSD-src-c87e4ea046fafb0b07c7ac3335948b0743fed8b4.zip
FreeBSD-src-c87e4ea046fafb0b07c7ac3335948b0743fed8b4.tar.gz
Fix infamous "TIOCGWINSZ: Interrupted system call" on return from a ^Z
Fixes PR#513 Reviewed by: Submitted by: Obtained from:
-rw-r--r--usr.bin/vi/sex/sex_window.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/vi/sex/sex_window.c b/usr.bin/vi/sex/sex_window.c
index 49b1f99..61000fb 100644
--- a/usr.bin/vi/sex/sex_window.c
+++ b/usr.bin/vi/sex/sex_window.c
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)sex_window.c 8.8 (Berkeley) 8/17/94";
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <errno.h>
#include "compat.h"
#include <curses.h>
@@ -79,7 +80,7 @@ sex_window(sp, sigwinch)
*
* Try TIOCGWINSZ.
*/
- row = col = 0;
+ errno = row = col = 0;
#ifdef TIOCGWINSZ
if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) != -1) {
row = win.ws_row;
@@ -89,7 +90,8 @@ sex_window(sp, sigwinch)
/* If here because of a signal, TIOCGWINSZ is all we trust. */
if (sigwinch) {
if (row == 0 || col == 0) {
- msgq(sp, M_SYSERR, "TIOCGWINSZ");
+ if (errno > 0)
+ msgq(sp, M_SYSERR, "TIOCGWINSZ");
return (1);
}
OpenPOWER on IntegriCloud