From: Ian Campbell Date: Mon, 9 Mar 2015 12:48:56 +0000 (+0000) Subject: tools: xl: handle unspecified extra= when dealing with root= X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=49ab17a3a615e1ab4ccc46d6942f925cf841df4b;p=people%2Fgdunlap%2Fxen.git 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 Cc: Chunyan Liu Acked-by: Wei Liu --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 399b6b6cee..a27ac9e91a 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -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); }