tools: xl: handle unspecified extra= when dealing with root=

If the cfg file includes root= but not extra= (nor cmdline=, which
supercedes both) then the command line will end up with an extra
"(null)" on it (at least with glibc's implementation of asprintf).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Chunyan Liu <cyliu@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Ian Campbell committed 2015-03-11 12:58:49 +00:00
1 parent e1eb56fb6b
commit 49ab17a3a6
1 file changed
+3 -1
+3 -1
View File
@@ -813,9 +813,11 @@ static char *parse_cmdline(XLU_Config *config)
fprintf(stderr, "Warning: ignoring root= and extra= "
"in favour of cmdline=\n");
} else {
if (root) {
if (root && extra) {
if (asprintf(&cmdline, "root=%s %s", root, extra) == -1)
cmdline = NULL;
} else if (root) {
cmdline = strdup(root);
} else if (extra) {
cmdline = strdup(extra);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.