diff options
author | 1848 <> | 2018-08-07 22:01:13 +0200 |
---|---|---|
committer | 1848 <> | 2018-08-07 22:01:13 +0200 |
commit | 737267cedca3b05bcb23ac6ab8d5a385b31db75b (patch) | |
tree | 60de19846dec5a74a4510951a21428035474fa1d /src/net | |
parent | 84054203afeb9f3c0ece9b85922bb357f9419d14 (diff) |
Moved call to fchmod() on socket from OneServerSocket::Open() to socket_bind_listen()
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/SocketUtil.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/net/SocketUtil.cxx b/src/net/SocketUtil.cxx index 6882f8958..de2c25917 100644 --- a/src/net/SocketUtil.cxx +++ b/src/net/SocketUtil.cxx @@ -23,6 +23,8 @@ #include "SocketError.hxx" #include "UniqueSocketDescriptor.hxx" +#include <sys/stat.h> + UniqueSocketDescriptor socket_bind_listen(int domain, int type, int protocol, SocketAddress address, @@ -32,6 +34,14 @@ socket_bind_listen(int domain, int type, int protocol, if (!fd.CreateNonBlock(domain, type, protocol)) throw MakeSocketError("Failed to create socket"); + +#ifdef HAVE_UN + if (domain == AF_UNIX) { + /* allow everybody to connect */ + fchmod(fd.Get(), 0666); + } +#endif + if (!fd.SetReuseAddress()) throw MakeSocketError("setsockopt() failed"); |