提交 307a0467 编写于 作者: M Michal Privoznik

qemu_command: Change logic in qemuVirCommandGet{FDSet,GetDevSet}

These two functions have pattern that's preventing us from
simpler virAsprintf() -> g_strdup_printf() transition. Modify
their logic a bit.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 9e9d7805
......@@ -256,13 +256,13 @@ qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
char *result = NULL;
int idx = virCommandPassFDGetFDIndex(cmd, fd);
if (idx >= 0) {
ignore_value(virAsprintf(&result, "set=%d,fd=%d", idx, fd));
} else {
if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("file descriptor %d has not been transferred"), fd);
return NULL;
}
ignore_value(virAsprintf(&result, "set=%d,fd=%d", idx, fd));
return result;
}
......@@ -283,12 +283,13 @@ qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
char *result = NULL;
int idx = virCommandPassFDGetFDIndex(cmd, fd);
if (idx >= 0) {
ignore_value(virAsprintf(&result, "/dev/fdset/%d", idx));
} else {
if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("file descriptor %d has not been transferred"), fd);
return NULL;
}
ignore_value(virAsprintf(&result, "/dev/fdset/%d", idx));
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册