summaryrefslogtreecommitdiff
path: root/src/basic/socket-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-07-25 16:40:26 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-07-25 16:40:26 -0400
commitdadd6ecfa5eaf842763dca545b4c04f33831789e (patch)
treece34705fdfe6a36b661384f934b697295ada0672 /src/basic/socket-util.c
parente28973ee182434b59ff562c9b22823250c9fdb4c (diff)
parentd82047bef5b8a35fb2d1d4685f241383df1a1d76 (diff)
Merge pull request #3728 from poettering/dynamic-users
Diffstat (limited to 'src/basic/socket-util.c')
-rw-r--r--src/basic/socket-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 385c3e4df3..6093e47172 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -1046,3 +1046,17 @@ int flush_accept(int fd) {
close(cfd);
}
}
+
+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;
+}