]> err.no Git - systemd/commitdiff
socket: if SO_RCVBUFFORCE fails, fall back to SO_RCVBUF, to have at least a little...
authorLennart Poettering <lennart@poettering.net>
Fri, 27 Jan 2012 17:58:02 +0000 (18:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 27 Jan 2012 17:58:02 +0000 (18:58 +0100)
src/socket.c

index 7409aea5eec4b539b5ef5b78b93443d7d080b586..67cd0cce8ebf5db54cba9fa8b372201ca1788051 100644 (file)
@@ -680,14 +680,19 @@ static void socket_apply_socket_options(Socket *s, int fd) {
 
         if (s->receive_buffer > 0) {
                 int value = (int) s->receive_buffer;
+
+                /* We first try with SO_RCVBUFFORCE, in case we have the perms for that */
+
                 if (setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0)
-                        log_warning("SO_RCVBUFFORCE failed: %m");
+                        if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) < 0)
+                                log_warning("SO_RCVBUF failed: %m");
         }
 
         if (s->send_buffer > 0) {
                 int value = (int) s->send_buffer;
                 if (setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0)
-                        log_warning("SO_SNDBUFFORCE failed: %m");
+                        if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) < 0)
+                                log_warning("SO_SNDBUF failed: %m");
         }
 
         if (s->mark >= 0)