Simplify, and return an error if the user attempts to set a TCP

time value which results in < 1 tick.

Suggested by: 	bde
This commit is contained in:
jlemon 1999-08-31 16:34:20 +00:00
parent 91e3e592b6
commit 5eaf6dca22

View File

@ -71,17 +71,13 @@ sysctl_msec_to_ticks SYSCTL_HANDLER_ARGS
tt = *(int *)oidp->oid_arg1;
s = tt * 1000 / hz;
error = SYSCTL_OUT(req, &s, sizeof(int));
error = sysctl_handle_int(oidp, &s, 0, req);
if (error || !req->newptr)
return (error);
error = SYSCTL_IN(req, &s, sizeof(int));
if (error)
return (error);
tt = s * hz / 1000;
if (tt == 0 && s > 0)
tt++;
if (tt < 1)
return (EINVAL);
*(int *)oidp->oid_arg1 = tt;
return (0);