summaryrefslogtreecommitdiff
path: root/accel-pppd/extra/net-snmp
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/extra/net-snmp')
-rw-r--r--accel-pppd/extra/net-snmp/agent.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/accel-pppd/extra/net-snmp/agent.c b/accel-pppd/extra/net-snmp/agent.c
index cfeb7639..9f8b1a74 100644
--- a/accel-pppd/extra/net-snmp/agent.c
+++ b/accel-pppd/extra/net-snmp/agent.c
@@ -1,5 +1,8 @@
+#include <errno.h>
#include <pthread.h>
+#include <sched.h>
#include <signal.h>
+#include <string.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
@@ -80,6 +83,14 @@ static void *snmp_thread(void *a)
sigdelset(&set, 32);
pthread_sigmask(SIG_BLOCK, &set, NULL);
+ if (unshare(CLONE_FILES) < 0) {
+ log_error("net-snmp: impossible to start SNMP thread:"
+ " unshare(CLONE_FILES) failed (%s)\n",
+ strerror(errno));
+
+ return NULL;
+ }
+
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_LOGGING, agent_log, NULL);
snmp_disable_log();
snmp_enable_calllog();