On Mon, May 17, 2010 at 01:06:23PM -0400, Cole Robinson wrote:
v2: Use intended F_OK. Drop devdir param, just check dev->path for
device
existence.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/util/pci.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index 81193b7..3fcc658 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1046,6 +1046,13 @@ pciGetDevice(unsigned domain,
snprintf(dev->path, sizeof(dev->path),
PCI_SYSFS "devices/%s/config", dev->name);
+ if (access(dev->path, F_OK) != 0) {
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Device %s not found"), dev->name);
This should do
virReportSystemError(errno,
_("unable to access PCI device %s at %s"),
dev->name, dev->path)
so that it lets us see the different types of problem access()
can return & reminds us what path we're complaining about.
+ pciFreeDevice(dev);
+ return NULL;
+ }
+
vendor = pciReadDeviceID(dev, "vendor");
product = pciReadDeviceID(dev, "device");
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|