提交 c8a4a020 编写于 作者: J John Ferlan

tests: Avoid possible error in testExecRestart

If the dup2 fails, then we aren't going to get the correct result.

Found by Coverity
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
ACKed-by: NPeter Krempa <pkrempa@redhat.com>
上级 6ae4f4a4
......@@ -287,10 +287,13 @@ static int testExecRestart(const void *opaque)
* fds 100->103 for something else, which is probably
* fairly reasonable in general
*/
dup2(fdserver[0], 100);
dup2(fdserver[1], 101);
dup2(fdclient[0], 102);
dup2(fdclient[1], 103);
if (dup2(fdserver[0], 100) < 0 ||
dup2(fdserver[1], 101) < 0 ||
dup2(fdclient[0], 102) < 0 ||
dup2(fdclient[1], 103) < 0) {
virReportSystemError(errno, "%s", "dup2() failed");
goto cleanup;
}
if (virAsprintf(&infile, "%s/virnetdaemondata/input-data-%s.json",
abs_srcdir, data->jsonfile) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册