summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-23 21:47:48 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-23 21:47:48 +0000
commit34273868d59e739c2529893b2d252f1f4a319179 (patch)
tree7ce3fd7813850405b2582e6db209a61b449a4221
parent9f9b522b4acc3be36581258fb278fcbf51b1c87a (diff)
vt100 wscons crashes restoring cursor if it had never been saved before.
From NetBSD (wsemul_vt100.c 1.24, wsemul_vt100var.h 1.7)
-rw-r--r--sys/dev/wscons/wsemul_vt100.c5
-rw-r--r--sys/dev/wscons/wsemul_vt100var.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c
index d4d02ae57ef..72e0fc648e0 100644
--- a/sys/dev/wscons/wsemul_vt100.c
+++ b/sys/dev/wscons/wsemul_vt100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100.c,v 1.10 2004/12/23 21:45:51 miod Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.11 2004/12/23 21:47:46 miod Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
@@ -463,6 +463,7 @@ wsemul_vt100_output_esc(edp, c)
newstate = VT100_EMUL_STATE_CSI;
break;
case '7': /* DECSC */
+ edp->flags |= VTFL_SAVEDCURS;
edp->savedcursor_row = edp->crow;
edp->savedcursor_col = edp->ccol;
edp->savedattr = edp->curattr;
@@ -476,6 +477,8 @@ wsemul_vt100_output_esc(edp, c)
edp->savedchartab1 = edp->chartab1;
break;
case '8': /* DECRC */
+ if ((edp->flags & VTFL_SAVEDCURS) == 0)
+ break;
edp->crow = edp->savedcursor_row;
edp->ccol = edp->savedcursor_col;
edp->curattr = edp->savedattr;
diff --git a/sys/dev/wscons/wsemul_vt100var.h b/sys/dev/wscons/wsemul_vt100var.h
index 198f2ee5d86..1c9eb66c81b 100644
--- a/sys/dev/wscons/wsemul_vt100var.h
+++ b/sys/dev/wscons/wsemul_vt100var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100var.h,v 1.4 2004/04/02 04:39:51 deraadt Exp $ */
+/* $OpenBSD: wsemul_vt100var.h,v 1.5 2004/12/23 21:47:47 miod Exp $ */
/* $NetBSD: wsemul_vt100var.h,v 1.5 2000/04/28 21:56:17 mycroft Exp $ */
/*
@@ -52,6 +52,7 @@ struct wsemul_vt100_emuldata {
#define VTFL_DECAWM 0x020 /* auto wrap */
#define VTFL_CURSORON 0x040
#define VTFL_NATCHARSET 0x080 /* national replacement charset mode */
+#define VTFL_SAVEDCURS 0x100 /* we have a saved cursor state */
long curattr, bkgdattr; /* currently used attribute */
int attrflags, fgcol, bgcol; /* properties of curattr */
u_int scrreg_startrow;