]> err.no Git - systemd/commitdiff
sd-daemon: fix abstract namespace sockaddr for notification socket
authorLennart Poettering <lennart@poettering.net>
Sun, 11 Jul 2010 21:49:02 +0000 (23:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 11 Jul 2010 21:49:20 +0000 (23:49 +0200)
src/sd-daemon.c

index 5df70e38d524d2f5866c31f54eb84e854761d941..3bb258d3418570fe6c5ac8540c47c089a77b703e 100644 (file)
@@ -381,7 +381,11 @@ int sd_notify(int unset_environment, const char *state) {
 
         memset(&msghdr, 0, sizeof(msghdr));
         msghdr.msg_name = &sockaddr;
-        msghdr.msg_namelen = sizeof(struct sockaddr_un);
+        msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e);
+
+        if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
+                msghdr.msg_namelen = sizeof(struct sockaddr_un);
+
         msghdr.msg_iov = &iovec;
         msghdr.msg_iovlen = 1;
         msghdr.msg_control = &control;