chiark / gitweb /
tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere
[elogind.git] / src / login / pam_elogind.c
index 95977426d9392cdf05236330c10d18bc548a1bf3..98dc20134052f5357dc0e2a413a4c69502027aee 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 /***
   This file is part of systemd.
 
@@ -152,7 +150,7 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_
         if (fd < 0)
                 return -errno;
 
-        if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0)
+        if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
                 return -errno;
 
         r = getpeercred(fd, &ucred);