Module: kamailio Branch: master Commit: 0b7b291ab153472c7d371c29e0c4dfa20c492f08 URL: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa2...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-12-27T09:08:08+01:00
snmpstats: init sigaction var and close fd in case of errors
---
Modified: src/modules/snmpstats/snmpstats.c Modified: src/modules/snmpstats/sub_agent.c
---
Diff: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa2... Patch: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa2...
---
diff --git a/src/modules/snmpstats/snmpstats.c b/src/modules/snmpstats/snmpstats.c index b2224ba47e..4bd11c98d2 100644 --- a/src/modules/snmpstats/snmpstats.c +++ b/src/modules/snmpstats/snmpstats.c @@ -539,6 +539,7 @@ static int spawn_sysUpTime_child(void) LM_ERR("Ran out of memory while trying to retrieve sysUpTime. "); LM_ERR(" kamailioSIPServiceStartTime is " "defaulting to zero\n"); + close(snmpget_fd); return -1; } else { /* Make a new string containing the full path to the binary. */ @@ -559,6 +560,7 @@ static int spawn_sysUpTime_child(void)
/* We should never be able to get here, because execve() is never * supposed to return. */ + close(snmpget_fd); free(full_path_to_snmpget); exit(-1); } @@ -587,4 +589,4 @@ int set_snmp_community(modparam_t type, void *val) snmp_community = (char *)val;
return 0; -} \ No newline at end of file +} diff --git a/src/modules/snmpstats/sub_agent.c b/src/modules/snmpstats/sub_agent.c index fc938d0f2c..330a86128e 100644 --- a/src/modules/snmpstats/sub_agent.c +++ b/src/modules/snmpstats/sub_agent.c @@ -167,6 +167,7 @@ void agentx_child(int rank) * need to be fatal however, because we can re-establish our * connection. Therefore we set ourselves up to ignore the * SIGPIPE. */ + sigemptyset(&sigpipe_handler.sa_mask); sigpipe_handler.sa_flags = SA_RESTART; sigpipe_handler.sa_handler = SIG_IGN;
@@ -194,4 +195,4 @@ void register_with_master_agent(char *name_to_register_under) /* Use a name we can register our agent under. */ init_snmp(name_to_register_under); LM_DBG("** Connected to SNMPD MasterX\n"); -} \ No newline at end of file +}