diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-09-07 23:34:09 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-09-07 23:34:09 +0300 |
commit | 262da64139b7be8fc08224d764ef048010611165 (patch) | |
tree | f2d63cea8672dec069177f9b3572d899d4b72b53 | |
parent | 2b5e299a28557a1bf33b0d0802cc6364dbdc97e0 (diff) |
prevent SO_REUSEPORT errors on systems that do not support them; fixes #2208
-rw-r--r-- | src/socket.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c index f6f3e946f0..d28df81a64 100644 --- a/src/socket.c +++ b/src/socket.c @@ -46,9 +46,10 @@ int sock_setreuse(int fd, int reuse) { int sock_setreuse_port(int fd, int reuse) { int ret = -1; + #ifdef SO_REUSEPORT ret = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(reuse)); - if(ret == -1) + if(ret == -1 && errno != ENOPROTOOPT) error("failed to set SO_REUSEPORT on socket %d", fd); #endif |