View | Details | Raw Unified | Return to bug 253966
Collapse All | Expand All

(-)net-mgmt/net-snmp/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	snmp
4
PORTNAME=	snmp
5
PORTVERSION=	5.9
5
PORTVERSION=	5.9
6
PORTREVISION=   2
6
PORTREVISION=   3
7
PORTEPOCH=	1
7
PORTEPOCH=	1
8
CATEGORIES=	net-mgmt
8
CATEGORIES=	net-mgmt
9
MASTER_SITES=	SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} \
9
MASTER_SITES=	SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} \
(-)net-mgmt/net-snmp/files/patch-agent_auto__nlist.c (+50 lines)
Line 0 Link Here
1
--- agent/auto_nlist.c.orig	2020-08-14 17:41:47 UTC
2
+++ agent/auto_nlist.c
3
@@ -142,6 +142,38 @@ auto_nlist(const char *string, char *var, size_t size)
4
     return 0;
5
 }
6
 
7
+#if HAVE_KVM_OPENFILES
8
+static int
9
+get_nlist(kvm_t *kernel, struct nlist nl[])
10
+{
11
+#ifdef __FreeBSD__
12
+    struct kvm_nlist *kl;
13
+    int count, i, ret;
14
+
15
+    for (count = 0; nl[count].n_name != NULL && nl[count].n_name[0] != '\0'; count++)
16
+        ;
17
+    if (count == 0)
18
+        return 0;
19
+    kl = calloc(count + 1, sizeof(*kl));
20
+    if (kl == NULL)
21
+        return -1;
22
+    for (i = 0; i < count; i++)
23
+        kl[i].n_name = nl[i].n_name;
24
+    if ((ret = kvm_nlist2(kernel, kl)) != -1)
25
+        for (i = 0; i < count; i++) {
26
+            nl[i].n_type = kl[i].n_type;
27
+            nl[i].n_other = 0;
28
+            nl[i].n_desc = 0;
29
+            nl[i].n_value = kl[i].n_value;
30
+        }
31
+    free(kl);
32
+    return ret;
33
+#else
34
+    return kvm_nlist(kernel, nl);
35
+#endif
36
+}
37
+#endif
38
+
39
 static void
40
 init_nlist(struct nlist nl[])
41
 {
42
@@ -161,7 +193,7 @@ init_nlist(struct nlist nl[])
43
             exit(1);
44
         }
45
     }
46
-    if ((ret = kvm_nlist(kernel, nl)) == -1) {
47
+    if ((ret = get_nlist(kernel, nl)) == -1) {
48
         if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
49
 				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
50
             return;

Return to bug 253966