daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
9fc0f6
From 9dda034962ef7d339f07e5cdeae87f34db970431 Mon Sep 17 00:00:00 2001
9fc0f6
From: Shawn Landden <shawn@churchofgit.com>
9fc0f6
Date: Sat, 16 Nov 2013 13:18:13 -0800
9fc0f6
Subject: [PATCH] core/socket: fix SO_REUSEPORT
9fc0f6
9fc0f6
---
9fc0f6
 src/core/load-fragment-gperf.gperf.m4 | 1 +
9fc0f6
 src/core/socket.c                     | 2 +-
9fc0f6
 2 files changed, 2 insertions(+), 1 deletion(-)
9fc0f6
9fc0f6
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
9fc0f6
index 31fb7bc..d65bcc1 100644
9fc0f6
--- a/src/core/load-fragment-gperf.gperf.m4
9fc0f6
+++ b/src/core/load-fragment-gperf.gperf.m4
9fc0f6
@@ -211,6 +211,7 @@ Socket.Broadcast,                config_parse_bool,                  0,
9fc0f6
 Socket.PassCredentials,          config_parse_bool,                  0,                             offsetof(Socket, pass_cred)
9fc0f6
 Socket.PassSecurity,             config_parse_bool,                  0,                             offsetof(Socket, pass_sec)
9fc0f6
 Socket.TCPCongestion,            config_parse_string,                0,                             offsetof(Socket, tcp_congestion)
9fc0f6
+Socket.ReusePort,                config_parse_bool,                  0,                             offsetof(Socket, reuseport)
9fc0f6
 Socket.MessageQueueMaxMessages,  config_parse_long,                  0,                             offsetof(Socket, mq_maxmsg)
9fc0f6
 Socket.MessageQueueMessageSize,  config_parse_long,                  0,                             offsetof(Socket, mq_msgsize)
9fc0f6
 Socket.Service,                  config_parse_socket_service,        0,                             0
9fc0f6
diff --git a/src/core/socket.c b/src/core/socket.c
9fc0f6
index d368f7e..e673f38 100644
9fc0f6
--- a/src/core/socket.c
9fc0f6
+++ b/src/core/socket.c
9fc0f6
@@ -770,7 +770,7 @@ static void socket_apply_socket_options(Socket *s, int fd) {
9fc0f6
 
9fc0f6
         if (s->reuseport) {
9fc0f6
                 int b = s->reuseport;
9fc0f6
-                if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)))
9fc0f6
+                if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)) < 0)
9fc0f6
                         log_warning_unit(UNIT(s)->id, "SO_REUSEPORT failed: %m");
9fc0f6
         }
9fc0f6