Fix ioctl MOUSE_SETMODE as defined in mouse(4).

(Do not return EINVAL when -1 is specified as a new value,
as it should mean "preserve the current value.")
This commit is contained in:
Kazutaka YOKOTA 2000-08-27 12:36:28 +00:00
parent e1669132dc
commit 201e598bbc

View File

@ -202,9 +202,12 @@ smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case MOUSE_SETMODE: /* set protocol/mode */
mode = (mousemode_t *)data;
if ((mode->level < 0) || (mode->level > 1))
if (mode->level == -1)
; /* don't change the current setting */
else if ((mode->level < 0) || (mode->level > 1))
return EINVAL;
mouse_level = mode->level;
else
mouse_level = mode->level;
return 0;
case MOUSE_GETLEVEL: /* get operation level */