Commit b9697482 authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Remove unneeded re-exec

When starting inside ns flavor the test_init() routine prepares
the binary to be run inside namespaces. In particular this routine
fork()-s an init, execve()-s one to pick up mappings and exe from
the new mntns and then fork()-s the test itself. In order to go
back to test_init() for test initialization the execve() is done
again, but it's actually not required and confuses the reader.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b3c8ee1b
...@@ -262,10 +262,9 @@ int ns_init(int argc, char **argv) ...@@ -262,10 +262,9 @@ int ns_init(int argc, char **argv)
fprintf(stderr, "fork() failed: %m\n"); fprintf(stderr, "fork() failed: %m\n");
exit(1); exit(1);
} else if (pid == 0) { } else if (pid == 0) {
setenv("ZDTM_NEWNS", "3", 1); close(status_pipe);
ret = execvp(argv[0], argv); unsetenv("ZDTM_NEWNS");
fprintf(stderr, "exec(%s) failed: %m\n", argv[0]); return 0; /* Continue normal test startup */
return ret;
} }
ret = -1; ret = -1;
...@@ -299,7 +298,7 @@ int ns_init(int argc, char **argv) ...@@ -299,7 +298,7 @@ int ns_init(int argc, char **argv)
write(status_pipe, &ret, sizeof(ret)); write(status_pipe, &ret, sizeof(ret));
close(status_pipe); close(status_pipe);
if (ret) if (ret)
return ret; exit(ret);
/* suspend/resume */ /* suspend/resume */
test_waitsig(); test_waitsig();
......
...@@ -115,10 +115,7 @@ void test_init(int argc, char **argv) ...@@ -115,10 +115,7 @@ void test_init(int argc, char **argv)
test_log_init(outfile, "ns"); test_log_init(outfile, "ns");
redir_stdfds(); redir_stdfds();
ns_init(argc, argv); ns_init(argc, argv);
exit(1);
} }
/* "3" -- run the test */
} }
val = getenv("ZDTM_GROUPS"); val = getenv("ZDTM_GROUPS");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment