summaryrefslogtreecommitdiff
path: root/src/sd-daemon.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-20 19:01:29 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-20 19:01:29 +0200
commitcd250a39da8d5b9c0d220a07e765064638708fe9 (patch)
tree5cb600a29ad393c095688a37fb0540fb722bec12 /src/sd-daemon.c
parent86700cf7adea335db27215a8be6d480c99ce4344 (diff)
sd-daemon: extend documentation a little
Diffstat (limited to 'src/sd-daemon.c')
-rw-r--r--src/sd-daemon.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sd-daemon.c b/src/sd-daemon.c
index 8a7c9e8dba..62936ec5b4 100644
--- a/src/sd-daemon.c
+++ b/src/sd-daemon.c
@@ -254,15 +254,16 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t
/* Unnamed socket */
return l == sizeof(sa_family_t);
- if (l < sizeof(sa_family_t) + length + 1)
- return 0;
-
if (path[0])
/* Normal path socket */
- return memcmp(path, sockaddr.un.sun_path, length+1) == 0;
+ return
+ (l >= sizeof(sa_family_t) + length + 1) &&
+ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
else
/* Abstract namespace socket */
- return memcmp(path, sockaddr.un.sun_path+1, length) == 0;
+ return
+ (l == sizeof(sa_family_t) + length) &&
+ memcmp(path, sockaddr.un.sun_path, length) == 0;
}
return 1;