]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmp-libpci-init.patch
- fix uber-stupid behaviour of libpci init error not returning but exiting the program
[packages/net-snmp.git] / net-snmp-libpci-init.patch
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);
14 +  fputs("pcilib: ", stderr);
15 +  vfprintf(stderr, msg, args);
16 +  fputc('\n', stderr);
17 +  _net_snmp_pci_status = 0;
18 +}
19  #endif
20  
21  #ifdef HAVE_LINUX_ETHTOOL_H
22 @@ -146,9 +158,13 @@
23  
24  #ifdef HAVE_PCI_LOOKUP_NAME
25      pci_access = pci_alloc();
26 -    if (pci_access)
27 +    if (pci_access) {
28         pci_init(pci_access);
29 -    else
30 +       if (_net_snmp_pci_status == 0) {
31 +           pci_cleanup(pci_access);
32 +           pci_access = NULL;
33 +       }
34 +    } else
35         snmp_log(LOG_ERR, "Unable to create pci access method\n");
36  #endif
37  }
This page took 0.061755 seconds and 4 git commands to generate.