[CRIU] [PATCH 3/3] zdtm: Relax on-stack args for ns creation

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 2 07:22:40 PST 2016


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 test/zdtm/lib/ns.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index ad26407..3f1c998 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -339,11 +339,9 @@ int ns_init(int argc, char **argv)
 void ns_create(int argc, char **argv)
 {
 	pid_t pid;
-	char pname[PATH_MAX];
 	int ret, status;
 	struct ns_exec_args args;
-	int fd, flags;
-	char *val;
+	int flags;
 
 	args.argc = argc;
 	args.argv = argv;
@@ -357,8 +355,7 @@ void ns_create(int argc, char **argv)
 	flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWUTS |
 		CLONE_NEWNET | CLONE_NEWIPC | SIGCHLD;
 
-	val = getenv("ZDTM_USERNS");
-	if (val)
+	if (getenv("ZDTM_USERNS"))
 		flags |= CLONE_NEWUSER;
 
 	pid = clone(ns_exec, args.stack_ptr, flags, &args);
@@ -370,6 +367,9 @@ void ns_create(int argc, char **argv)
 	close(args.status_pipe[1]);
 
 	if (flags & CLONE_NEWUSER) {
+		char pname[PATH_MAX];
+		int fd;
+
 		snprintf(pname, sizeof(pname), "/proc/%d/uid_map", pid);
 		fd = open(pname, O_WRONLY);
 		if (fd < 0) {
-- 
2.5.0



More information about the CRIU mailing list