[lxc-devel] [lxcfs/master] Also check next variable for NULL on cg_rmdir

Xeno22 on Github lxc-bot at linuxcontainers.org
Fri Jan 27 17:35:56 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1705 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170127/dd0b7fa1/attachment.bin>
-------------- next part --------------
From 6966976726baa630dbe1d7057c429d65c2466d2f Mon Sep 17 00:00:00 2001
From: Xeno <martin.zwickel at efficient.it>
Date: Fri, 27 Jan 2017 18:20:39 +0100
Subject: [PATCH 1/2] Also check next variable for NULL

---
 bindings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings.c b/bindings.c
index 3516be6..a23c349 100644
--- a/bindings.c
+++ b/bindings.c
@@ -2908,7 +2908,7 @@ int cg_rmdir(const char *path)
 	if (initpid <= 0)
 		initpid = fc->pid;
 	if (!caller_is_in_ancestor(initpid, controller, cgroup, &next)) {
-		if (!last || strcmp(next, last) == 0)
+		if (!last || (next && (strcmp(next, last) == 0)))
 			ret = -EBUSY;
 		else
 			ret = -ENOENT;

From 39e464f3ae6127e8ebb3b4e5f7e6901cbf753c07 Mon Sep 17 00:00:00 2001
From: Xeno <martin.zwickel at efficient.it>
Date: Fri, 27 Jan 2017 18:20:39 +0100
Subject: [PATCH 2/2] Also check next variable for NULL on cg_rmdir

Signed-off-by: Martin Zwickel <martin.zwickel at googlemail.com>
---
 bindings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings.c b/bindings.c
index 3516be6..a23c349 100644
--- a/bindings.c
+++ b/bindings.c
@@ -2908,7 +2908,7 @@ int cg_rmdir(const char *path)
 	if (initpid <= 0)
 		initpid = fc->pid;
 	if (!caller_is_in_ancestor(initpid, controller, cgroup, &next)) {
-		if (!last || strcmp(next, last) == 0)
+		if (!last || (next && (strcmp(next, last) == 0)))
 			ret = -EBUSY;
 		else
 			ret = -ENOENT;


More information about the lxc-devel mailing list