OSDN Git Service

Make scanpci exit cleanly if pci_system_init() fails.
authorEric Anholt <eric@anholt.net>
Fri, 3 Aug 2007 17:40:53 +0000 (10:40 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 3 Aug 2007 17:40:53 +0000 (10:40 -0700)
src/scanpci.c

index a3ec5c5..2c49d80 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <err.h>
 
 #include "pciaccess.h"
 
@@ -176,8 +177,11 @@ int main( int argc, char ** argv )
 {
     struct pci_device_iterator * iter;
     struct pci_device * dev;
+    int ret;
 
-    pci_system_init();
+    ret = pci_system_init();
+    if (ret != 0)
+       err(1, "Couldn't initialize PCI system");
 
     iter = pci_slot_match_iterator_create( NULL );