sysinfo: Avoid libpci crash when pci not available
Turns out libpci is an awful library that on any error calls exit() and has no way of indicating an error otherwise...
This commit is contained in:
parent
c6d9e26e2b
commit
47b653cc7c
|
@ -92,6 +92,11 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
|
||||||
struct pci_dev *p;
|
struct pci_dev *p;
|
||||||
int nomatch = 1;
|
int nomatch = 1;
|
||||||
|
|
||||||
|
/* libpci has no way to report errors it calls exit()
|
||||||
|
* so we need to manually avoid potential failures like this one */
|
||||||
|
if (!g_file_test ("/proc/bus/pci", G_FILE_TEST_EXISTS))
|
||||||
|
return 1;
|
||||||
|
|
||||||
pacc = pci_alloc();
|
pacc = pci_alloc();
|
||||||
pci_filter_init(pacc, &filter);
|
pci_filter_init(pacc, &filter);
|
||||||
pci_init(pacc);
|
pci_init(pacc);
|
||||||
|
|
Loading…
Reference in New Issue