summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/basic/socket-util.c14
-rw-r--r--src/basic/socket-util.h2
-rw-r--r--src/libelogind/sd-bus/bus-common-errors.c1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index f47a8f04e..16646ff9d 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -1052,3 +1052,17 @@ int flush_accept(int fd) {
}
}
#endif // 0
+
+struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t length) {
+ struct cmsghdr *cmsg;
+
+ assert(mh);
+
+ CMSG_FOREACH(cmsg, mh)
+ if (cmsg->cmsg_level == level &&
+ cmsg->cmsg_type == type &&
+ (length == (socklen_t) -1 || length == cmsg->cmsg_len))
+ return cmsg;
+
+ return NULL;
+}
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
index b5d1dc3ed..a88ab9fd2 100644
--- a/src/basic/socket-util.h
+++ b/src/basic/socket-util.h
@@ -150,6 +150,8 @@ int flush_accept(int fd);
#define CMSG_FOREACH(cmsg, mh) \
for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg)))
+struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t length);
+
/* Covers only file system and abstract AF_UNIX socket addresses, but not unnamed socket addresses. */
#define SOCKADDR_UN_LEN(sa) \
({ \
diff --git a/src/libelogind/sd-bus/bus-common-errors.c b/src/libelogind/sd-bus/bus-common-errors.c
index 6457cfe09..e38e2e0dc 100644
--- a/src/libelogind/sd-bus/bus-common-errors.c
+++ b/src/libelogind/sd-bus/bus-common-errors.c
@@ -45,6 +45,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = {
SD_BUS_ERROR_MAP(BUS_ERROR_NO_ISOLATION, EPERM),
SD_BUS_ERROR_MAP(BUS_ERROR_SHUTTING_DOWN, ECANCELED),
SD_BUS_ERROR_MAP(BUS_ERROR_SCOPE_NOT_RUNNING, EHOSTDOWN),
+ SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_DYNAMIC_USER, ESRCH),
SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_MACHINE, ENXIO),
SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_IMAGE, ENOENT),