chiark / gitweb /
util: never use sizeof(sa_family_t) when calculating sockaddr sizes
[elogind.git] / src / manager.c
index c062cfb5ed3f19fb33bde2d7456843022902c960..4ee04e181fb6c62e47f84232b438761017f8734d 100644 (file)
@@ -92,7 +92,7 @@ static int manager_setup_notify(Manager *m) {
         else
                 strncpy(sa.un.sun_path+1, NOTIFY_SOCKET, sizeof(sa.un.sun_path)-1);
 
-        if (bind(m->notify_watch.fd, &sa.sa, sizeof(sa_family_t) + 1 + strlen(sa.un.sun_path+1)) < 0) {
+        if (bind(m->notify_watch.fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
                 log_error("bind() failed: %m");
                 return -errno;
         }