[PATCH] Make sure all command line arguments get passed to UML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Soren Hansen <soren@xxxxxxxxxxx>

If umlBuildCommandLineChr fails (e.g. due to an unsupported chardev
type), it returns NULL. umlBuildCommandLine does not check for this and
sets this as an argument on the comand line, effectively ending the
argument list. This patch checks for this case and sets the chardev to
"none".

Signed-off-by: Soren Hansen <soren@xxxxxxxxxxx>
---
 src/uml/uml_conf.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 1623a78..42193e4 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -511,10 +511,10 @@ int umlBuildCommandLine(virConnectPtr conn,
     }
 
     for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
-        char *ret;
+        char *ret = NULL;
         if (i == 0 && vm->def->console)
             ret = umlBuildCommandLineChr(vm->def->console, "con");
-        else
+        if (!ret)
             if (virAsprintf(&ret, "con%d=none", i) < 0)
                 goto no_memory;
         ADD_ARG(ret);
@@ -522,13 +522,13 @@ int umlBuildCommandLine(virConnectPtr conn,
 
     for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
         virDomainChrDefPtr chr = NULL;
-        char *ret;
+        char *ret = NULL;
         for (j = 0 ; j < vm->def->nserials ; j++)
             if (vm->def->serials[j]->target.port == i)
                 chr = vm->def->serials[j];
         if (chr)
             ret = umlBuildCommandLineChr(chr, "ssl");
-        else
+        if (!ret)
             if (virAsprintf(&ret, "ssl%d=none", i) < 0)
                 goto no_memory;
         ADD_ARG(ret);
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]