From 31ac51a8ef2e062f1eb785b57f590b63a7df3673 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 1 Feb 2020 17:34:29 +0100 Subject: [PATCH] snmp: tentative to fix compilation with older versions of NetSNMP 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/daemon/agent_priv.c b/src/daemon/agent_priv.c index 84f1ad0e..c317e6e6 100644 --- a/src/daemon/agent_priv.c +++ b/src/daemon/agent_priv.c @@ -33,11 +33,17 @@ #include #include +#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; -- 2.39.5