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>
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);
}