aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/vi
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1995-08-07 16:44:28 +0000
committerPeter Wemm <peter@FreeBSD.org>1995-08-07 16:44:28 +0000
commit8e53a8e6fc66c9fbe9b277c18b90c11de39d7b7a (patch)
tree7ae33f67d95d96832805966762c01906d8c079dc /usr.bin/vi
parent5ac0875800487de1b19d43a22c7477e2ba685a57 (diff)
Notes
Diffstat (limited to 'usr.bin/vi')
-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 49b1f990f3c4..61000fba53d6 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);
}