Commit e628b63b authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: close an external tty

Redirect standard descriptors of a test init process in to the log file.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 499e4486
......@@ -246,8 +246,6 @@ int ns_init(int argc, char **argv)
/* suspend/resume */
test_waitsig();
parseargs(argc, argv);
fd = open(pidfile, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "open(%s) failed: %m\n", pidfile);
......
......@@ -141,10 +141,10 @@ void parseargs(int argc, char ** argv)
value = strchr(name, '=');
if (value)
*value++ = '\0';
value++;
for (opt = opt_head; opt; opt = opt->next)
if (!strcmp(name, opt->name)) {
if (!strncmp(name, opt->name, value - name - 1)) {
if (opt->parse_opt(value, opt->value)) {
fprintf(stderr, "%s: failed to parse\n", argv[i]);
helpexit();
......
......@@ -107,6 +107,8 @@ void test_init(int argc, char **argv)
};
sigemptyset(&sa.sa_mask);
parseargs(argc, argv);
val = getenv("ZDTM_NEWNS");
if (val) {
unsetenv("ZDTM_NEWNS");
......@@ -116,6 +118,8 @@ void test_init(int argc, char **argv)
val = getenv("ZDTM_EXE");
if (val) {
test_log_init(outfile, "ns");
redir_stdfds();
unsetenv("ZDTM_EXE");
ns_init(argc, argv);
exit(1);
......@@ -131,8 +135,6 @@ void test_init(int argc, char **argv)
exit(1);
}
parseargs(argc, argv);
setup_outfile();
redir_stdfds();
......
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