[CRIU] [PATCH 2/2] sysctl: don't skip erros

Andrey Vagin avagin at gmail.com
Tue Dec 8 00:35:19 PST 2015


From: Andrey Vagin <avagin at openvz.org>

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sysctl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sysctl.c b/sysctl.c
index 9afbe03..6ef8ce5 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -344,7 +344,7 @@ out:
 
 static int __nonuserns_sysctl_op(struct sysctl_req *req, size_t nr_req, int op)
 {
-	int dir, ret = -1;;
+	int dir, ret, exit_code = -1;;
 
 	dir = open("/proc/sys", O_RDONLY, O_DIRECTORY);
 	if (dir < 0) {
@@ -370,15 +370,16 @@ static int __nonuserns_sysctl_op(struct sysctl_req *req, size_t nr_req, int op)
 		}
 
 		ret = do_sysctl_op(fd, req, op);
+		if (ret)
+			goto out;
 		close(fd);
 		req++;
 	}
 
-	ret = 0;
-
+	exit_code = 0;
 out:
 	close(dir);
-	return ret;
+	return exit_code;
 }
 
 int sysctl_op(struct sysctl_req *req, size_t nr_req, int op, unsigned int ns)
-- 
2.4.3



More information about the CRIU mailing list