diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-23 01:00:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-29 21:08:37 +0200 |
commit | 3ee897d6c2401effbc82f5eef35fce405781d6c8 (patch) | |
tree | 86d1d6e0c432a22aba4d51dee56015f8b85d8b9b /src/libsystemd/sd-bus | |
parent | 400f1a33cf63ddaa41af5d5b0bcd5be73e0404a6 (diff) |
tree-wide: port more code to use send_one_fd() and receive_one_fd()
Also, make it slightly more powerful, by accepting a flags argument, and
make it safe for handling if more than one cmsg attribute happens to be
attached.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-container.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/libsystemd/sd-bus/bus-container.c b/src/libsystemd/sd-bus/bus-container.c index 5c607f49b1..435ec92d6f 100644 --- a/src/libsystemd/sd-bus/bus-container.c +++ b/src/libsystemd/sd-bus/bus-container.c @@ -217,15 +217,8 @@ int bus_container_connect_kernel(sd_bus *b) { _exit(EXIT_FAILURE); } - cmsg = CMSG_FIRSTHDR(&mh); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - memcpy(CMSG_DATA(cmsg), &fd, sizeof(int)); - - mh.msg_controllen = cmsg->cmsg_len; - - if (sendmsg(pair[1], &mh, MSG_NOSIGNAL) < 0) + r = send_one_fd(pair[1], fd, 0); + if (r < 0) _exit(EXIT_FAILURE); _exit(EXIT_SUCCESS); |