Package: cgmanager / 0.33-2+deb8u2

0001-do_move_pid_main-don-t-break-out-of-while-loop-on-er.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 33c51da88a480d70103d264a98c70d277b98f312 Mon Sep 17 00:00:00 2001
From: Cameron Norman <camerontnorman@gmail.com>
Date: Sun, 12 Oct 2014 10:38:47 -0700
Subject: [PATCH 1/2] do_move_pid_main: don't break out of while loop on error;
 return error after

---
 cgmanager.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/cgmanager.c b/cgmanager.c
index e77fd64..28a9264 100644
--- a/cgmanager.c
+++ b/cgmanager.c
@@ -188,6 +188,7 @@ int do_move_pid_main(const char *controller, const char *cgroup, struct ucred p,
 	nih_local char *c = NULL;
 	char *tok;
 	int ret;
+	int while_ret = 0;
 
 	if (!sane_cgroup(cgroup)) {
 		nih_error("%s: unsafe cgroup", __func__);
@@ -214,15 +215,16 @@ int do_move_pid_main(const char *controller, const char *cgroup, struct ucred p,
 	tok = strtok(c, ",");
 	while (tok) {
 		ret = per_ctrl_move_pid_main(tok, cgroup, p, r, v, escape);
-		if (ret == -2)  // permission denied - ignore for group requests
-			goto next;
-		if (ret != 0)
-			return -1;
-next:
+
+		/* Save error for later (but ignore permission denied, -2),
+		   but try to complete rest of moves anyway */
+		if (ret != 0 && ret != -2)
+			while_ret = -1;
+
 		tok = strtok(NULL, ",");
 	}
 
-	return 0;
+	return while_ret;
 }
 
 int move_pid_main(const char *controller, const char *cgroup, struct ucred p,
-- 
2.1.0