xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Marek Marczykowski <marmarek@mimuw.edu.pl>
To: xen-devel@lists.xensource.com
Cc: marmarek@mimuw.edu.pl
Subject: [PATCH 09 of 10] libxl: Do not SEGV when no 'removable' disk parameter in xenstore
Date: Fri, 03 Jun 2011 00:35:39 +0200	[thread overview]
Message-ID: <10bdf8aa5b8a1cb2178f.1307054139@devel14> (raw)
In-Reply-To: <patchbomb.1307054130@devel14>

# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1306963174 -7200
# Node ID 10bdf8aa5b8a1cb2178f2b9cbcc9ce2fd5644403
# Parent  d03bd7a830bff8162b6b0564d27b3f36ca52d8bb
libxl: Do not SEGV when no 'removable' disk parameter in xenstore

Just assume disk as not removable when no 'removable' paremeter

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1722,6 +1722,7 @@
                              libxl__xs_get_dompath(&gc, 0), type, domid);
     dir = libxl__xs_directory(&gc, XBT_NULL, be_path, &n);
     if (dir) {
+        char *removable;
         *disks = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
         pdisk = *disks + *ndisks;
         *ndisks += n;
@@ -1740,7 +1741,11 @@
                 libxl__sprintf(&gc, "%s/%s/type", be_path, *dir)), 
                 &(pdisk->backend));
             pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path, *dir), &len);
-            pdisk->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path, *dir)));
+            removable = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path, *dir));
+            if (removable)
+                pdisk->unpluggable = atoi(removable);
+            else
+                pdisk->unpluggable = 0;
             if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path, *dir)), "w"))
                 pdisk->readwrite = 1;
             else

  parent reply	other threads:[~2011-06-02 22:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 22:35 [PATCH 00 of 10] A bunch of fixes (and one feature) for libxl Marek Marczykowski
2011-06-02 22:35 ` [PATCH 01 of 10] libxl: Remove frontend and backend devices from xenstore after destroy Marek Marczykowski
2011-06-03  8:03   ` Ian Campbell
2011-06-03 23:30     ` Marek Marczykowski
2011-06-04  6:46       ` Ian Campbell
2011-06-02 22:35 ` [PATCH 02 of 10] libxl: Do not start stubdom when not needed Marek Marczykowski
2011-06-03  8:03   ` Ian Campbell
2011-06-02 22:35 ` [PATCH 03 of 10] libxl: Accept disk name in libxl_devid_to_device_disk Marek Marczykowski
2011-06-03  8:08   ` Ian Campbell
2011-06-02 22:35 ` [PATCH 04 of 10] libxl: Allocate memory for strings in libxl_device_disk Marek Marczykowski
2011-06-03  8:10   ` Ian Campbell
2011-06-02 22:35 ` [PATCH 05 of 10] libxl: Set libxl_device_nic->domid when looking up by devid Marek Marczykowski
2011-06-03  8:11   ` Ian Campbell
2011-06-03 23:24     ` Marek Marczykowski
2011-06-04  6:47       ` Ian Campbell
2011-06-02 22:35 ` [PATCH 06 of 10] xl: Allocate memory for libxl_device_nic string members Marek Marczykowski
2011-06-03  8:13   ` Ian Campbell
2011-06-02 22:35 ` [PATCH 07 of 10] xl: Fix 'script' param parsing in network-attach Marek Marczykowski
2011-06-03  8:16   ` Ian Campbell
2011-06-03 23:49     ` Marek Marczykowski
2011-06-04  8:25       ` Ian Campbell
2011-06-02 22:35 ` [PATCH 08 of 10] xen.lowlevel.xl: Return None on empty domain name Marek Marczykowski
2011-06-03  8:22   ` Ian Campbell
2011-06-02 22:35 ` Marek Marczykowski [this message]
2011-06-02 22:35 ` [PATCH 10 of 10] libxl: "script:" prefix in block device description to setup vbd by hotplug scripts Marek Marczykowski
2011-06-03  8:24   ` 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=10bdf8aa5b8a1cb2178f.1307054139@devel14 \
    --to=marmarek@mimuw.edu.pl \
    --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).