chiark / gitweb /
tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere
authorLennart Poettering <lennart@poettering.net>
Thu, 5 May 2016 20:24:36 +0000 (22:24 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:58 +0000 (10:12 +0200)
commit34a47924489b195799b36932f56db80f2d4e1ab6
tree067936d960bb2b0f88f24c18fa4615fd14defc43
parenta799bc503d6055ecc97fce94d0685fdfe055a3f4
tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere

The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to
connect() or bind(). It automatically figures out if the socket refers to an
abstract namespace socket, or a socket in the file system, and properly handles
the full length of the path field.

This macro is not only safer, but also simpler to use, than the usual
offsetof() + strlen() logic.
src/basic/log.c
src/basic/socket-util.h
src/libelogind/sd-bus/sd-bus.c
src/libelogind/sd-daemon/sd-daemon.c
src/login/pam_elogind.c