]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
snmp: tentative to fix compilation with older versions of NetSNMP
authorVincent Bernat <vincent@bernat.ch>
Sat, 1 Feb 2020 16:34:29 +0000 (17:34 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sat, 1 Feb 2020 16:36:02 +0000 (17:36 +0100)
In fact, gcc doesn't consider the signatures to be compatible when
using a function pointer. Let's use a preprocessor trick to detect the
version and hope gcc is OK with `char*` changed to `void*`.

src/daemon/agent_priv.c

index 84f1ad0e9d9f6f94689fc80a3a94aa222548978b..c317e6e6285cc09087e3c9943012147c4511ddef 100644 (file)
 #include <net-snmp/agent/snmp_vars.h>
 #include <net-snmp/library/snmpUnixDomain.h>
 
+#ifdef ASN_PRIV_STOP
+#define CONST58 const
+#else
+#define CONST58
+#endif
+
 static oid netsnmp_unix[] = { TRANSPORT_DOMAIN_LOCAL };
 static netsnmp_tdomain unixDomain;
 
 static char *
-agent_priv_unix_fmtaddr(netsnmp_transport *t, const void *data, int len)
+agent_priv_unix_fmtaddr(netsnmp_transport *t, CONST58 void *data, int len)
 {
        /* We don't bother to implement the full function */
        return strdup("Local Unix socket with privilege separation: unknown");
@@ -80,7 +86,7 @@ recv_error:
 
 #define AGENT_WRITE_TIMEOUT 2000
 static int
-agent_priv_unix_send(netsnmp_transport *t, const void *buf, int size,
+agent_priv_unix_send(netsnmp_transport *t, CONST58 void *buf, int size,
     void **opaque, int *olength)
 {
        int rc = -1;