xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Zhigang Wang <zhigang.x.wang@oracle.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Zhigang Wang <zhigang.x.wang@oracle.com>
Subject: [PATCH] [PATCH] libxl: fix bootloader args setting [with diff]
Date: Mon, 06 Feb 2012 10:14:07 -0500	[thread overview]
Message-ID: <72f1296a55a470426e1c.1328541247@zhigang.us.oracle.com> (raw)

# HG changeset patch
# User Zhigang Wang <zhigang.x.wang@oracle.com>
# Date 1328541193 18000
# Node ID 72f1296a55a470426e1c3e5b8b2ba907ab6eb78c
# Parent  3432abcf9380d3840ca38439a304f74a37d155fc
libxl: fix bootloader args setting

When bootloader_args = ['foo', 'bar'], then info->u.pv.bootloader_args =

    foo\0
    bar\0
    \0

Before this patch, 'p++' points to the next character of 'foo\0' and never
comes to 'bar\0' (because of the '\0' in 'foo\0'), so the args will be:

    args[0] = 'oo\0'
    args[1] = 'o\0'

After this patch, 'p++' points to the next string of pv.bootloader_args, so we
get the correct args:

    args[0] = 'foo\0'
    args[1] = 'bar\0'

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>

diff -r 3432abcf9380 -r 72f1296a55a4 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Thu Feb 02 15:47:26 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c	Mon Feb 06 10:13:13 2012 -0500
@@ -49,9 +49,11 @@ static char **make_bootloader_args(libxl
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
 
     if (info->u.pv.bootloader_args) {
-        char *p = info->u.pv.bootloader_args[0];
-        while (*(p++))
-            flexarray_set(args, nr++, p);
+        char **p = info->u.pv.bootloader_args;
+        while (*p) {
+            flexarray_set(args, nr++, *p);
+            p++;
+        }
     }
 
     flexarray_set(args, nr++, disk);

             reply	other threads:[~2012-02-06 15:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 15:14 Zhigang Wang [this message]
2012-02-08 13:44 ` [PATCH] [PATCH] libxl: fix bootloader args setting [with diff] Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72f1296a55a470426e1c.1328541247@zhigang.us.oracle.com \
    --to=zhigang.x.wang@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).