X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.c;h=241e7520b9d35fd4d763868aa5557baa2eacc370;hb=3bec6d4690d2a7f08dc27b8221299c1db94978c4;hp=deb98396335acbe26ff4f3626c678747537739cd;hpb=20f56fddcd58c84fa73597486e905c652667214f;p=elogind.git
diff --git a/src/shared/util.c b/src/shared/util.c
index deb983963..241e7520b 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -19,7 +19,6 @@
along with systemd; If not, see .
***/
-#include
#include
#include
#include
@@ -48,7 +47,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -83,7 +81,6 @@
#include "missing.h"
#include "log.h"
#include "strv.h"
-#include "label.h"
#include "mkdir.h"
#include "path-util.h"
#include "exit-status.h"
@@ -8110,3 +8107,13 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
return -1;
}
+
+void cmsg_close_all(struct msghdr *mh) {
+ struct cmsghdr *cmsg;
+
+ assert(mh);
+
+ for (cmsg = CMSG_FIRSTHDR(mh); cmsg; cmsg = CMSG_NXTHDR(mh, cmsg))
+ if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
+ close_many((int*) CMSG_DATA(cmsg), (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int));
+}