summaryrefslogtreecommitdiff
path: root/net/net-snmp/patches
diff options
context:
space:
mode:
authorseb <seb@pkgsrc.org>2006-10-02 00:09:55 +0000
committerseb <seb@pkgsrc.org>2006-10-02 00:09:55 +0000
commit66cee1c2f5245dcfdba2d83cea30c1a36e2f23f7 (patch)
tree84ffce86398c8a2eeef21eeaec45231e12b82c62 /net/net-snmp/patches
parent5f14471edff1ef1dc754ad97ab821b6efe76efe8 (diff)
downloadpkgsrc-66cee1c2f5245dcfdba2d83cea30c1a36e2f23f7.tar.gz
Fix a NetBSD/sparc64 bug: give sysctl() a pointer on a size_t not on an int!
While here check for sysctl() return value. Now snmpd on NetBSD/sparc64 should report more meaningful values for OIDs like UCD-SNMP-MIB::memAvailReal.0. Bump PKGREVISION.
Diffstat (limited to 'net/net-snmp/patches')
-rw-r--r--net/net-snmp/patches/patch-es39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/net-snmp/patches/patch-es b/net/net-snmp/patches/patch-es
new file mode 100644
index 00000000000..b7630418bce
--- /dev/null
+++ b/net/net-snmp/patches/patch-es
@@ -0,0 +1,39 @@
+$NetBSD: patch-es,v 1.1 2006/10/02 00:09:55 seb Exp $
+
+--- agent/mibgroup/ucd-snmp/memory_netbsd1.c.orig 2005-08-17 12:36:14.000000000 +0000
++++ agent/mibgroup/ucd-snmp/memory_netbsd1.c
+@@ -163,7 +163,7 @@ var_extensible_mem(struct variable *vp,
+ static char errmsg[1024];
+
+ static struct uvmexp uvmexp;
+- int uvmexp_size = sizeof(uvmexp);
++ size_t uvmexp_size = sizeof(uvmexp);
+ int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
+ static struct vmtotal total;
+ size_t total_size = sizeof(total);
+@@ -179,13 +179,22 @@ var_extensible_mem(struct variable *vp,
+ /*
+ * Memory info
+ */
+- sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
+- sysctl(total_mib, 2, &total, &total_size, NULL, 0);
++ if (sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0) == -1) {
++ snmp_log(LOG_ERR, "sysctl VM_UVMEXP failed (errno %d)\n", errno);
++ return NULL;
++ }
++ if (sysctl(total_mib, 2, &total, &total_size, NULL, 0) == -1) {
++ snmp_log(LOG_ERR, "sysctl VM_METER failed (errno %d)\n", errno);
++ return NULL;
++ }
+
+ /*
+ * Physical memory
+ */
+- sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
++ if (sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0) == -1) {
++ snmp_log(LOG_ERR, "sysctl HW_USERMEM failed (errno %d)\n", errno);
++ return NULL;
++ }
+
+ long_ret = 0; /* set to 0 as default */
+