[lxc-devel] [lxd/master] forksyscall: use correct error handling for chdirchroot()
brauner on Github
lxc-bot at linuxcontainers.org
Tue Jul 16 13:52:49 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190716/e6ae9850/attachment.bin>
-------------- next part --------------
From 4fc91dc1385ffa5dd8c6bf0911380ea4ed3b46bb Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 16 Jul 2019 15:51:59 +0200
Subject: [PATCH] forksyscall: use correct error handling for chdirchroot()
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/main_forksyscall.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lxd/main_forksyscall.go b/lxd/main_forksyscall.go
index 79a99347f9..e0b3a14719 100644
--- a/lxd/main_forksyscall.go
+++ b/lxd/main_forksyscall.go
@@ -169,10 +169,11 @@ static void forkmknod()
_exit(EXIT_FAILURE);
}
- if (chdirchroot(pid)) {
+ if (!chdirchroot(pid)) {
fprintf(stderr, "%d", ENOANO);
_exit(EXIT_FAILURE);
}
+
if (setns(mnt_fd, CLONE_NEWNS)) {
fprintf(stderr, "%d", ENOANO);
_exit(EXIT_FAILURE);
More information about the lxc-devel
mailing list