tools: xl: handle unspecified extra= when dealing with root=
PATCH 1/1 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 <[email protected]>
Cc Chunyan Liu <[email protected]>
--- tools/libxl/xl_cmdimpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +3 -1
@@ -817,9 +817,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); }
Signature · 1 line
1.7.10.4
Quoted 6 lines · Ian Campbell
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 <[email protected]>Cc Chunyan Liu <[email protected]>
Acked-by Wei Liu <[email protected]>
Quoted 23 lines
--- tools/libxl/xl_cmdimpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/libxl/xl_cmdimpl.c +3
-1@@ -817,9 +817,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); }Signature · 1 line
1.7.10.4
Ian Campbell
AppliedQuoted 9 lines · Wei Liu
Quoted 6 lines · Ian Campbell
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 <[email protected]>Cc Chunyan Liu <[email protected]>Acked-by Wei Liu <[email protected]>
Applied, thanks.