[lxc-devel] [lxc/master] attach.c small fix,more logical

hupangpang on Github lxc-bot at linuxcontainers.org
Fri Dec 22 10:19:45 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 351 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171222/32de3e7d/attachment.bin>
-------------- next part --------------
From 43d221f302fcba021b2549aea3c584bc2878800d Mon Sep 17 00:00:00 2001
From: huqiang <huqiang.alpha at foxmail.com>
Date: Fri, 22 Dec 2017 18:17:31 +0800
Subject: [PATCH] attach.c small fix,more logical Signed-off-by: huqiang
 <huqiang.alpha at foxmail.com>

---
 src/lxc/attach.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 5ef0802a2..b31450016 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -305,9 +305,10 @@ static int in_same_namespace(pid_t pid1, pid_t pid2, const char *ns)
 		goto out;
 
 	/* processes are in the same namespace */
-	ret = -EINVAL;
-	if ((ns_st1.st_dev == ns_st2.st_dev ) && (ns_st1.st_ino == ns_st2.st_ino))
+	if ((ns_st1.st_dev == ns_st2.st_dev ) && (ns_st1.st_ino == ns_st2.st_ino)) {
+		ret = -EINVAL;
 		goto out;
+	}
 
 	/* processes are in different namespaces */
 	ret = ns_fd2;


More information about the lxc-devel mailing list