summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-11 23:49:02 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-11 23:49:20 +0200
commita013bd94cc0137c20236f3db2fa156ada9373e59 (patch)
tree94877d3637f678c32070bdbcb8c0a8b0cb6e9f4d
parentc2ad51299afe046f3a65b4f57bcbd38b2cce2234 (diff)
sd-daemon: fix abstract namespace sockaddr for notification socket
-rw-r--r--src/sd-daemon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sd-daemon.c b/src/sd-daemon.c
index 5df70e38d5..3bb258d341 100644
--- a/src/sd-daemon.c
+++ b/src/sd-daemon.c
@@ -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;