From 0e098b15c76e222f7de381203c0c35a75a5b2f24 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 7 Oct 2010 02:34:17 +0200 Subject: util: never use sizeof(sa_family_t) when calculating sockaddr sizes --- src/systemctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/systemctl.c') diff --git a/src/systemctl.c b/src/systemctl.c index 45249aaa3b..918dcbe8b5 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -4875,7 +4876,7 @@ static int send_shutdownd(usec_t t, char mode, bool warn, const char *message) { zero(msghdr); msghdr.msg_name = &sockaddr; - msghdr.msg_namelen = sizeof(sa_family_t) + 1 + sizeof("/org/freedesktop/systemd1/shutdownd") - 1; + msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + 1 + sizeof("/org/freedesktop/systemd1/shutdownd") - 1; msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; -- cgit v1.2.3-54-g00ecf