Fix exception when calling dup2 with -1

This commit is contained in:
d-komarov 2018-02-18 23:16:03 +02:00 committed by Arvid Norberg
parent 59bdb3db81
commit 22e9370cb6
1 changed files with 2 additions and 2 deletions

View File

@ -490,8 +490,8 @@ EXPORT int main(int argc, char const* argv[])
fclose(t.output); fclose(t.output);
} }
if (redirect_stdout) dup2(old_stdout, fileno(stdout)); if (redirect_stdout && old_stdout != -1) dup2(old_stdout, fileno(stdout));
if (redirect_stderr) dup2(old_stderr, fileno(stderr)); if (redirect_stderr && old_stderr != -1) dup2(old_stderr, fileno(stderr));
if (!tests_to_run.empty()) if (!tests_to_run.empty())
{ {