aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Jude <allanjude@FreeBSD.org>2021-11-04 12:55:33 +0000
committerMark Johnston <markj@FreeBSD.org>2022-03-24 17:09:29 +0000
commit4f69c575996e069bfee62af9db2faa3ffa65db71 (patch)
tree3e441c50d75760a130de8883a6c486fd07462bf0
parente7867aaa35d0970baa33c2aaa959829d84034558 (diff)
downloadsrc-4f69c575996e069bfee62af9db2faa3ffa65db71.tar.gz
src-4f69c575996e069bfee62af9db2faa3ffa65db71.zip
Allow kern.ipc.maxsockets to be set to current value without error
Normally setting kern.ipc.maxsockets returns EINVAL if the new value is not greater than the previous value. This can cause spurious error messages when sysctl.conf is processed multiple times, or when automation systems try to ensure the sysctl is set to the correct value. If the value is unchanged, then just do nothing. PR: 243532 Reviewed by: markj Sponsored by: Modirum MDPay Sponsored by: Klara Inc. (cherry picked from commit c441592a0e1591591665cd037a8a5e9b54675f99)
-rw-r--r--sys/kern/uipc_socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 5a3748eb8cf5..bdd7756916d9 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -363,7 +363,7 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS)
newmaxsockets = maxsockets;
error = sysctl_handle_int(oidp, &newmaxsockets, 0, req);
- if (error == 0 && req->newptr) {
+ if (error == 0 && req->newptr && newmaxsockets != maxsockets) {
if (newmaxsockets > maxsockets &&
newmaxsockets <= maxfiles) {
maxsockets = newmaxsockets;