]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
udev: Parse PCI devices even if libpciaccess fails
authorCole Robinson <crobinso@redhat.com>
Wed, 30 Jun 2010 19:57:54 +0000 (15:57 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 2 Jul 2010 14:30:29 +0000 (10:30 -0400)
We only use libpciaccess for resolving device product/vendor. If
initializing the library fails (say if using qemu:///session), don't
warn so loudly, and carry on as usual.

src/node_device/node_device_udev.c

index 73217c5e0c0dcac341cfeccdf012c9c2b0ba19c1..02e44a1cdeda46c1663a6722b6cce4fdaddc8596 100644 (file)
@@ -363,12 +363,15 @@ static int udevTranslatePCIIds(unsigned int vendor,
                                char **vendor_string,
                                char **product_string)
 {
-    int ret = -1;
+    int ret = -1, pciret;
     struct pci_id_match m;
     const char *vendor_name = NULL, *device_name = NULL;
 
-    if (pci_system_init() != 0) {
-        VIR_ERROR0(_("Failed to initialize libpciaccess"));
+    if ((pciret = pci_system_init()) != 0) {
+        char ebuf[256];
+        VIR_INFO("Failed to initialize libpciaccess: %s",
+                 virStrerror(pciret, ebuf, sizeof ebuf));
+        ret = 0;
         goto out;
     }