]>
Commit | Line | Data |
---|---|---|
aedc886d JR |
1 | --- net-snmp-5.7/agent/mibgroup/if-mib/data_access/interface_linux.c.orig 2011-07-02 00:35:46.000000000 +0200 |
2 | +++ net-snmp-5.7/agent/mibgroup/if-mib/data_access/interface_linux.c 2011-08-07 21:10:45.760672551 +0200 | |
3 | @@ -19,6 +19,18 @@ | |
4 | #ifdef HAVE_PCI_LOOKUP_NAME | |
5 | #include <pci/pci.h> | |
6 | static struct pci_access *pci_access; | |
7 | +static int _net_snmp_pci_status = 1; | |
8 | + | |
9 | +static void _net_snmp_pci_error(char *msg, ...) | |
10 | +{ | |
11 | + va_list args; | |
12 | + | |
13 | + va_start(args, msg); | |
a77f681d JR |
14 | + snmp_log(LOG_ERR, "pcilib: "); |
15 | + snmp_vlog(LOG_ERR, msg, args); | |
16 | + snmp_log(LOG_ERR, "\n"); | |
aedc886d JR |
17 | + _net_snmp_pci_status = 0; |
18 | +} | |
19 | #endif | |
20 | ||
21 | #ifdef HAVE_LINUX_ETHTOOL_H | |
b9dbb13f | 22 | @@ -146,9 +158,15 @@ |
aedc886d JR |
23 | |
24 | #ifdef HAVE_PCI_LOOKUP_NAME | |
25 | pci_access = pci_alloc(); | |
26 | - if (pci_access) | |
27 | + if (pci_access) { | |
47d41a86 | 28 | + pci_access->error = _net_snmp_pci_error; |
aedc886d JR |
29 | pci_init(pci_access); |
30 | - else | |
31 | + if (_net_snmp_pci_status == 0) { | |
32 | + pci_cleanup(pci_access); | |
33 | + pci_access = NULL; | |
b9dbb13f | 34 | + snmp_log(LOG_ERR, "Unable to create pci access method (libpci)\n"); |
aedc886d JR |
35 | + } |
36 | + } else | |
37 | snmp_log(LOG_ERR, "Unable to create pci access method\n"); | |
38 | #endif | |
39 | } |