]> xenbits.xensource.com Git - people/gdunlap/xen.git/commitdiff
tools: xl: handle unspecified extra= when dealing with root=
authorIan Campbell <ian.campbell@citrix.com>
Mon, 9 Mar 2015 12:48:56 +0000 (12:48 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 11 Mar 2015 12:58:49 +0000 (12:58 +0000)
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>
tools/libxl/xl_cmdimpl.c

index 399b6b6cee6acf19f8057add8ebc43cece0ab47b..a27ac9e91ad1e4313d62faa1aa5081349c7520aa 100644 (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);
         }