提交 cb0c3a70 编写于 作者: M Michal Privoznik

virCommand: Make virCommandPassFDGetFDIndex fail if passed command is in error state

The idea of virCommand* APIs is that a possible error that
occurred while constructing cmd line is kept in virCommand
struct. If that's the case all subsequent calls to virCommand*()
are NO-OPs or they return an error. Well,
virCommandPassFDGetFDIndex() is not honoring that.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 aa308f7f
......@@ -1034,6 +1034,9 @@ virCommandPassFDGetFDIndex(virCommandPtr cmd, int fd)
{
size_t i = 0;
if (!cmd || cmd->has_error)
return -1;
while (i < cmd->npassfd) {
if (cmd->passfd[i].fd == fd)
return i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册