This patch is here just to ease the code review and make related
changes look more sensible.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d8a7951..6ff9fd5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8803,32 +8803,30 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgBuffer(cmd, &opt);
}
- if (def->nserials) {
- for (i = 0; i < def->nserials; i++) {
- virDomainChrDefPtr serial = def->serials[i];
- char *devstr;
+ for (i = 0; i < def->nserials; i++) {
+ virDomainChrDefPtr serial = def->serials[i];
+ char *devstr;
- /* Use -chardev with -device if they are available */
- if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
- virCommandAddArg(cmd, "-chardev");
- if (!(devstr = qemuBuildChrChardevStr(&serial->source,
- serial->info.alias,
- qemuCaps)))
- goto error;
- virCommandAddArg(cmd, devstr);
- VIR_FREE(devstr);
+ /* Use -chardev with -device if they are available */
+ if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
+ virCommandAddArg(cmd, "-chardev");
+ if (!(devstr = qemuBuildChrChardevStr(&serial->source,
+ serial->info.alias,
+ qemuCaps)))
+ goto error;
+ virCommandAddArg(cmd, devstr);
+ VIR_FREE(devstr);
- if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0)
- goto error;
- } else {
- virCommandAddArg(cmd, "-serial");
- if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
- goto error;
- virCommandAddArg(cmd, devstr);
- VIR_FREE(devstr);
- }
- actualSerials++;
+ if (qemuBuildChrDeviceCommandLine(cmd, def, serial, qemuCaps) < 0)
+ goto error;
+ } else {
+ virCommandAddArg(cmd, "-serial");
+ if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL)))
+ goto error;
+ virCommandAddArg(cmd, devstr);
+ VIR_FREE(devstr);
}
+ actualSerials++;
}
/* If we have -device, then we set -nodefault already */
--
1.8.5.4