systemd: update systemd glue code
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Jul 2010 00:50:02 +0000 (02:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Jul 2010 00:50:02 +0000 (02:50 +0200)
dbus/sd-daemon.c

index 5df70e3..3bb258d 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;