From: Martin Pitt Date: Sun, 8 May 2016 19:09:35 +0000 (+0200) Subject: Merge pull request #3202 from poettering/socket-fixes X-Git-Tag: v230~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d75103d4c68f13ecf3d09234c1506d58e8fae80e;p=thirdparty%2Fsystemd.git Merge pull request #3202 from poettering/socket-fixes don't reopen socket fds when reloading the daemon --- d75103d4c68f13ecf3d09234c1506d58e8fae80e diff --cc src/basic/socket-util.h index daa4b24a374,9f6a3013688..160f7c484ba --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@@ -135,16 -135,7 +135,18 @@@ int receive_one_fd(int transport_fd, in ssize_t next_datagram_size_fd(int fd); + int flush_accept(int fd); + #define CMSG_FOREACH(cmsg, mh) \ for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg))) + +/* Covers only file system and abstract AF_UNIX socket addresses, but not unnamed socket addresses. */ +#define SOCKADDR_UN_LEN(sa) \ + ({ \ + const struct sockaddr_un *_sa = &(sa); \ + assert(_sa->sun_family == AF_UNIX); \ + offsetof(struct sockaddr_un, sun_path) + \ + (_sa->sun_path[0] == 0 ? \ + 1 + strnlen(_sa->sun_path+1, sizeof(_sa->sun_path)-1) : \ + strnlen(_sa->sun_path, sizeof(_sa->sun_path))); \ + })