ryantimwilson / rpms / systemd

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