net/SocketUtil: fix -Wunused

This commit is contained in:
Max Kellermann 2017-08-10 13:22:00 +02:00
parent 79e75bfbb9
commit d84dae488e

View File

@ -28,8 +28,6 @@ socket_bind_listen(int domain, int type, int protocol,
SocketAddress address, SocketAddress address,
int backlog) int backlog)
{ {
const int reuse = 1;
UniqueSocketDescriptor fd; UniqueSocketDescriptor fd;
if (!fd.CreateNonBlock(domain, type, protocol)) if (!fd.CreateNonBlock(domain, type, protocol))
throw MakeSocketError("Failed to create socket"); throw MakeSocketError("Failed to create socket");
@ -44,8 +42,9 @@ socket_bind_listen(int domain, int type, int protocol,
throw MakeSocketError("Failed to listen on socket"); throw MakeSocketError("Failed to listen on socket");
#if defined(HAVE_STRUCT_UCRED) && defined(SO_PASSCRED) #if defined(HAVE_STRUCT_UCRED) && defined(SO_PASSCRED)
const int pass_cred = 1;
setsockopt(fd.Get(), SOL_SOCKET, SO_PASSCRED, setsockopt(fd.Get(), SOL_SOCKET, SO_PASSCRED,
(const char *) &reuse, sizeof(reuse)); (const char *) &pass_cred, sizeof(pass_cred));
#endif #endif
return fd; return fd;