mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 01:07:21 +01:00
- 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
This commit is contained in:
parent
e64c88b2dc
commit
a4fc697e58
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80151
@ -942,22 +942,22 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
case VT_ACTIVATE: /* switch to screen *data */
|
case VT_ACTIVATE: /* switch to screen *data */
|
||||||
|
i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
|
||||||
s = spltty();
|
s = spltty();
|
||||||
sc_clean_up(sc->cur_scp);
|
sc_clean_up(sc->cur_scp);
|
||||||
splx(s);
|
splx(s);
|
||||||
return sc_switch_scr(sc, *(int *)data - 1);
|
return sc_switch_scr(sc, i);
|
||||||
|
|
||||||
case VT_WAITACTIVE: /* wait for switch to occur */
|
case VT_WAITACTIVE: /* wait for switch to occur */
|
||||||
if ((*(int *)data >= sc->first_vty + sc->vtys)
|
i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
|
||||||
|| (*(int *)data < sc->first_vty))
|
if ((i < sc->first_vty) || (i >= sc->first_vty + sc->vtys))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
s = spltty();
|
s = spltty();
|
||||||
error = sc_clean_up(sc->cur_scp);
|
error = sc_clean_up(sc->cur_scp);
|
||||||
splx(s);
|
splx(s);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
if (*(int *)data != 0)
|
scp = SC_STAT(SC_DEV(sc, i));
|
||||||
scp = SC_STAT(SC_DEV(sc, *(int *)data - 1));
|
|
||||||
if (scp == scp->sc->cur_scp)
|
if (scp == scp->sc->cur_scp)
|
||||||
return 0;
|
return 0;
|
||||||
while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH,
|
while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH,
|
||||||
|
Loading…
Reference in New Issue
Block a user