From 35b4e3c1bc7d4001244ff3986c084152c8901d03 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 11 Sep 2020 19:58:54 +0200 Subject: [PATCH] socket: downgrade log warnings about inability to set socket buffer sizes In containers we might lack the privs to up the socket buffers. Let's not complain so loudly about that. Let's hence downgrade this to debug logging if it's a permission problem. (This wasn't an issue before b92f350789e33942be0cf85af22a580c1fd483d6 because back then the failures wouldn't be detected at all.) --- src/core/socket.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/socket.c b/src/core/socket.c index 04177ea7a5..02841f0e24 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1061,13 +1061,15 @@ static void socket_apply_socket_options(Socket *s, SocketPort *p, int fd) { if (s->receive_buffer > 0) { r = fd_set_rcvbuf(fd, s->receive_buffer, false); if (r < 0) - log_unit_warning_errno(UNIT(s), r, "SO_RCVBUF/SO_RCVBUFFORCE failed: %m"); + log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r, + "SO_RCVBUF/SO_RCVBUFFORCE failed: %m"); } if (s->send_buffer > 0) { r = fd_set_sndbuf(fd, s->send_buffer, false); if (r < 0) - log_unit_warning_errno(UNIT(s), r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m"); + log_unit_full_errno(UNIT(s), ERRNO_IS_PRIVILEGE(r) ? LOG_DEBUG : LOG_WARNING, r, + "SO_SNDBUF/SO_SNDBUFFORCE failed: %m"); } if (s->mark >= 0) {