summaryrefslogtreecommitdiff
path: root/src/listensocket.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-05-29 13:53:52 +0100
committerPeter Powell <petpow@saberuk.com>2019-05-30 11:51:01 +0100
commit08d2ff86b0c7ed91549d832cf3e572c8623dc8e8 (patch)
treec9de38e9b663dc88cc86e32af900e09e73077ab4 /src/listensocket.cpp
parent33932b95e4b886aec8ac1bf3e3e1665826bcd0ea (diff)
Various improvements to UNIX socket support.
- Allow replacing dead UNIX sockets on startup. - Allow setting the permissions of the UNIX socket. - Expand the UNIX socket path relative to the data directory.
Diffstat (limited to 'src/listensocket.cpp')
-rw-r--r--src/listensocket.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 60ee0b449..3d6b11568 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -66,6 +66,13 @@ ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_t
#endif
}
+ if (bind_to.family() == AF_UNIX)
+ {
+ unsigned int permissions = tag->getUInt("permissions", 0, 0, 777);
+ if (permissions)
+ chmod(bind_to.str().c_str(), permissions);
+ }
+
SocketEngine::SetReuse(fd);
int rv = SocketEngine::Bind(this->fd, bind_to);
if (rv >= 0)