Moved call to fchmod() on socket from OneServerSocket::Open() to socket_bind_listen()

This commit is contained in:
1848
2018-08-07 22:01:13 +02:00
parent 84054203af
commit 737267cedc
2 changed files with 10 additions and 8 deletions

View File

@@ -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");