summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-03 10:40:53 -0700
committerEric Anholt <eric@anholt.net>2007-08-03 10:40:53 -0700
commit14e62c77bd1ae6ef1d4048df2da96eeff8f7538f (patch)
tree7889aa83c561e3ecb7d4a332810a4d17546d481d
parenta7faac3d2dc49a2130906fbeea3298f32bb9349f (diff)
Make scanpci exit cleanly if pci_system_init() fails.
-rw-r--r--src/scanpci.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/scanpci.c b/src/scanpci.c
index a3ec5c5..2c49d80 100644
--- a/src/scanpci.c
+++ b/src/scanpci.c
@@ -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 );