Fix receiving sockets from systemd in libaskuser-notification 48/122848/1
authorRafal Krypa <r.krypa@samsung.com>
Mon, 3 Apr 2017 15:10:02 +0000 (17:10 +0200)
committerRafal Krypa <r.krypa@samsung.com>
Mon, 3 Apr 2017 16:07:11 +0000 (18:07 +0200)
The error was in setting listening=1 argument in sd_is_socket_unix().
We are serving both stream and datagram socket and listening is valind only
for stream sockets. This lead to not catching the datagram socket.

Change-Id: Ie10b289870e12a895a3d8799788f2da4379da06f
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
src/common/protocol/sock.cpp

index afceddd..2f72433 100644 (file)
@@ -85,7 +85,7 @@ int Sock::getSocketFromSystemD() {
         return -1;
 
     for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START+n; ++fd)
-        if (0 < sd_is_socket_unix(fd, getUnixSockType(), 1, m_path.c_str(), 0))
+        if (0 < sd_is_socket_unix(fd, getUnixSockType(), -1, m_path.c_str(), 0))
             return fd;
 #endif // BUILD_WITH_SYSTEMD_DAEMON
     return -1;