From a4475f577bd0daf762d6c3b4e58bc484e0cb74af Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Dec 2013 01:03:09 +0100 Subject: bus: when entering an existing namespace to connect to a container's system bus also switch over PID namespace This is necessary to ensure that kdbus can collect creds of the destination namespace when connecting. --- src/machine/machinectl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/machine') diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index f5485b3d42..fd21a0a815 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -399,7 +399,7 @@ static int terminate_machine(sd_bus *bus, char **args, unsigned n) { static int openpt_in_namespace(pid_t pid, int flags) { _cleanup_close_pipe_ int pair[2] = { -1, -1 }; - _cleanup_close_ int nsfd = -1, rootfd = -1; + _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, rootfd = -1; union { struct cmsghdr cmsghdr; uint8_t buf[CMSG_SPACE(sizeof(int))]; @@ -413,7 +413,7 @@ static int openpt_in_namespace(pid_t pid, int flags) { pid_t child; siginfo_t si; - r = namespace_open(pid, &nsfd, &rootfd); + r = namespace_open(pid, &pidnsfd, &mntnsfd, &rootfd); if (r < 0) return r; @@ -428,7 +428,7 @@ static int openpt_in_namespace(pid_t pid, int flags) { close_nointr_nofail(pair[0]); pair[0] = -1; - r = namespace_enter(nsfd, rootfd); + r = namespace_enter(pidnsfd, mntnsfd, rootfd); if (r < 0) _exit(EXIT_FAILURE); -- cgit v1.2.3-54-g00ecf