mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 00:51:24 +03:00
sd-device: do not change buffer size if the socket is already bound
From the results of CIs in #11076, changing buffer size may cause
issue #10754. So, let's prohibit to change the size if it is already
bound.
This also reverts commit 986ab0d2dc
.
This commit is contained in:
parent
c821e84ac7
commit
903893237a
@ -93,6 +93,12 @@ _public_ int sd_device_monitor_set_receive_buffer_size(sd_device_monitor *m, siz
|
||||
assert_return(m, -EINVAL);
|
||||
assert_return((size_t) n == size, -EINVAL);
|
||||
|
||||
if (m->bound)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||
"sd-device-monitor: Socket fd is already bound. "
|
||||
"It may be dangerous to change buffer size. "
|
||||
"Refusing to change buffer size.");
|
||||
|
||||
if (setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUF, n) < 0) {
|
||||
r = setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUFFORCE, n);
|
||||
if (r < 0)
|
||||
|
@ -1630,8 +1630,7 @@ static int manager_new(Manager **ret, int fd_ctrl, int fd_uevent, const char *cg
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to initialize device monitor: %m");
|
||||
|
||||
if (fd_uevent < 0)
|
||||
(void) sd_device_monitor_set_receive_buffer_size(manager->monitor, 128 * 1024 * 1024);
|
||||
(void) sd_device_monitor_set_receive_buffer_size(manager->monitor, 128 * 1024 * 1024);
|
||||
|
||||
/* unnamed socket from workers to the main daemon */
|
||||
r = socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, manager->worker_watch);
|
||||
|
Loading…
Reference in New Issue
Block a user