提交 3ad8cbd3 编写于 作者: S Soren Hansen 提交者: Eric Blake

Make sure all command line arguments get passed to UML

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: NSoren Hansen <soren@linux2go.dk>
上级 753d76e0
...@@ -513,10 +513,10 @@ int umlBuildCommandLine(virConnectPtr conn, ...@@ -513,10 +513,10 @@ int umlBuildCommandLine(virConnectPtr conn,
} }
for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) { for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
char *ret; char *ret = NULL;
if (i == 0 && vm->def->console) if (i == 0 && vm->def->console)
ret = umlBuildCommandLineChr(vm->def->console, "con"); ret = umlBuildCommandLineChr(vm->def->console, "con");
else if (!ret)
if (virAsprintf(&ret, "con%d=none", i) < 0) if (virAsprintf(&ret, "con%d=none", i) < 0)
goto no_memory; goto no_memory;
ADD_ARG(ret); ADD_ARG(ret);
...@@ -524,13 +524,13 @@ int umlBuildCommandLine(virConnectPtr conn, ...@@ -524,13 +524,13 @@ int umlBuildCommandLine(virConnectPtr conn,
for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) { for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
virDomainChrDefPtr chr = NULL; virDomainChrDefPtr chr = NULL;
char *ret; char *ret = NULL;
for (j = 0 ; j < vm->def->nserials ; j++) for (j = 0 ; j < vm->def->nserials ; j++)
if (vm->def->serials[j]->target.port == i) if (vm->def->serials[j]->target.port == i)
chr = vm->def->serials[j]; chr = vm->def->serials[j];
if (chr) if (chr)
ret = umlBuildCommandLineChr(chr, "ssl"); ret = umlBuildCommandLineChr(chr, "ssl");
else if (!ret)
if (virAsprintf(&ret, "ssl%d=none", i) < 0) if (virAsprintf(&ret, "ssl%d=none", i) < 0)
goto no_memory; goto no_memory;
ADD_ARG(ret); ADD_ARG(ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册