From: Simon Horman Subject: qemu-xen: pass-through: Catch errors in do_pci_del() Date: Mon, 1 Jun 2009 12:33:43 +1000 Message-ID: <20090601023343.GC11304@verge.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org Signed-off-by: Simon Horman --- The strdup() is needed because the aprsing of devname is destructive. I have patches to fix this if there is interest. Index: ioemu-remote/xen-vl-extra.c =================================================================== --- ioemu-remote.orig/xen-vl-extra.c 2009-04-06 10:04:39.000000000 +1000 +++ ioemu-remote/xen-vl-extra.c 2009-04-06 10:06:41.000000000 +1000 @@ -119,9 +119,21 @@ static int tap_open(char *ifname, int if void do_pci_del(char *devname) { int pci_slot; + char *devname_cpy; + + devname_cpy = strdup(devname); + if (!devname_cpy) + return; + pci_slot = bdf_to_slot(devname); - acpi_php_del(pci_slot); + if (pci_slot < 0) + fprintf(logfile, "Device \"%s\" is not used by a hotplug device.\n", + devname_cpy); + else + acpi_php_del(pci_slot); + + free(devname_cpy); } void do_pci_add(char *devname)