All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: xl: handle unspecified extra= when dealing with root=
@ 2015-03-09 12:48 Ian Campbell
  2015-03-09 13:00 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2015-03-09 12:48 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, wei.liu2, Ian Campbell, Chunyan Liu

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>
---
 tools/libxl/xl_cmdimpl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 96fbe63..2c32a96 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -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);
         }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: xl: handle unspecified extra= when dealing with root=
  2015-03-09 12:48 [PATCH] tools: xl: handle unspecified extra= when dealing with root= Ian Campbell
@ 2015-03-09 13:00 ` Wei Liu
  2015-03-11 13:12   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2015-03-09 13:00 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, wei.liu2, Chunyan Liu, xen-devel

On Mon, Mar 09, 2015 at 12:48:56PM +0000, Ian Campbell wrote:
> 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 |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 96fbe63..2c32a96 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -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);
>          }
> -- 
> 1.7.10.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: xl: handle unspecified extra= when dealing with root=
  2015-03-09 13:00 ` Wei Liu
@ 2015-03-11 13:12   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-03-11 13:12 UTC (permalink / raw)
  To: Wei Liu; +Cc: ian.jackson, Chunyan Liu, xen-devel

On Mon, 2015-03-09 at 13:00 +0000, Wei Liu wrote:
> On Mon, Mar 09, 2015 at 12:48:56PM +0000, Ian Campbell wrote:
> > 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-11 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 12:48 [PATCH] tools: xl: handle unspecified extra= when dealing with root= Ian Campbell
2015-03-09 13:00 ` Wei Liu
2015-03-11 13:12   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.