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:
parent
91e3e592b6
commit
5eaf6dca22
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user