mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
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: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9e9d78057d
commit
307a04671b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user