summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>2001-07-22 13:58:23 +0000
committeryokota <yokota@FreeBSD.org>2001-07-22 13:58:23 +0000
commite0f20204b26f782a155d4288d1e3b66e7189b0f4 (patch)
tree9cf91f3e573390f68fe1a350a930509ffffc187b /sys/dev/syscons
parentd57dc6ad00720393b8c34a6f0df1bbb7c10f9edc (diff)
downloadFreeBSD-src-e0f20204b26f782a155d4288d1e3b66e7189b0f4.zip
FreeBSD-src-e0f20204b26f782a155d4288d1e3b66e7189b0f4.tar.gz
- Fix "off by one" error in VT_WAITACTIVATE. Correctly accept
0 as meaning the requesting vty. - Accept 0 as the requesting vty in VT_ACTIVATE as in VT_WAITACTIVE. PR: 24423 MFC after: 10 days
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index f0ba0d3..c461097 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -942,22 +942,22 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
return EINVAL;
case VT_ACTIVATE: /* switch to screen *data */
+ i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
s = spltty();
sc_clean_up(sc->cur_scp);
splx(s);
- return sc_switch_scr(sc, *(int *)data - 1);
+ return sc_switch_scr(sc, i);
case VT_WAITACTIVE: /* wait for switch to occur */
- if ((*(int *)data >= sc->first_vty + sc->vtys)
- || (*(int *)data < sc->first_vty))
+ i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
+ if ((i < sc->first_vty) || (i >= sc->first_vty + sc->vtys))
return EINVAL;
s = spltty();
error = sc_clean_up(sc->cur_scp);
splx(s);
if (error)
return error;
- if (*(int *)data != 0)
- scp = SC_STAT(SC_DEV(sc, *(int *)data - 1));
+ scp = SC_STAT(SC_DEV(sc, i));
if (scp == scp->sc->cur_scp)
return 0;
while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH,
OpenPOWER on IntegriCloud