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
9987d77844
commit
9fc2bcf662
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50705
@ -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…
Reference in New Issue
Block a user