Moved call to fchmod() on socket from OneServerSocket::Open() to socket_bind_listen()
This commit is contained in:
parent
84054203af
commit
737267cedc
@ -39,7 +39,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -184,13 +183,6 @@ OneServerSocket::Open()
|
|||||||
SOCK_STREAM, 0,
|
SOCK_STREAM, 0,
|
||||||
address, 5);
|
address, 5);
|
||||||
|
|
||||||
#ifdef HAVE_UN
|
|
||||||
/* allow everybody to connect */
|
|
||||||
|
|
||||||
if (!path.IsNull())
|
|
||||||
fchmod(_fd.Get(), 0666);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* register in the EventLoop */
|
/* register in the EventLoop */
|
||||||
|
|
||||||
SetFD(_fd.Release());
|
SetFD(_fd.Release());
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include "SocketError.hxx"
|
#include "SocketError.hxx"
|
||||||
#include "UniqueSocketDescriptor.hxx"
|
#include "UniqueSocketDescriptor.hxx"
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
UniqueSocketDescriptor
|
UniqueSocketDescriptor
|
||||||
socket_bind_listen(int domain, int type, int protocol,
|
socket_bind_listen(int domain, int type, int protocol,
|
||||||
SocketAddress address,
|
SocketAddress address,
|
||||||
@ -32,6 +34,14 @@ socket_bind_listen(int domain, int type, int protocol,
|
|||||||
if (!fd.CreateNonBlock(domain, type, protocol))
|
if (!fd.CreateNonBlock(domain, type, protocol))
|
||||||
throw MakeSocketError("Failed to create socket");
|
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())
|
if (!fd.SetReuseAddress())
|
||||||
throw MakeSocketError("setsockopt() failed");
|
throw MakeSocketError("setsockopt() failed");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user