[lxc-devel] [lxd/master] forksyscall: use correct function

brauner on Github lxc-bot at linuxcontainers.org
Wed Oct 14 16:23:45 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 442 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201014/19170863/attachment.bin>
-------------- next part --------------
From 00587b8755563027597bc42e2d7d85570f658519 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 14 Oct 2020 18:22:43 +0200
Subject: [PATCH] forksyscall: use correct function

Somehow the compiler didn't detect that we called a non-existing function.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/main_forksyscall.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/main_forksyscall.go b/lxd/main_forksyscall.go
index 4b770e73e7..a5b9c565da 100644
--- a/lxd/main_forksyscall.go
+++ b/lxd/main_forksyscall.go
@@ -35,7 +35,7 @@ import (
 extern char* advance_arg(bool required);
 extern void attach_userns_fd(int ns_fd);
 extern int pidfd_nsfd(int pidfd, pid_t pid);
-extern int preserve_ns(const int pid, const char *ns);
+extern int preserve_ns(pid_t pid, int ns_fd, const char *ns);
 extern bool change_namespaces(int pidfd, int nsfd, unsigned int flags);
 
 static bool chdirchroot_in_mntns(int cwd_fd, int root_fd)
@@ -371,7 +371,7 @@ static void mount_emulate(void)
 		data = advance_arg(false);
 	}
 
-	mnt_fd = preserve_ns(getpid(), "mnt");
+	mnt_fd = preserve_ns(getpid(), ns_fd, "mnt");
 	if (mnt_fd < 0)
 		_exit(EXIT_FAILURE);
 


More information about the lxc-devel mailing list