Mercurial > hg > release > heapstats-1.1
changeset 15:6c73e9d7876c
Bug 1696: The SNMP settings are changed unexpectedly when HeapStats agent reloads the configuration.
reviewed-by: yasuenag
author | KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> |
---|---|
date | Wed, 12 Mar 2014 18:54:11 +0900 |
parents | 229309c835e7 |
children | 6086194b2867 |
files | agent/src/classContainer.cpp agent/src/trapSender.hpp agent/src/util.cpp |
diffstat | 3 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/src/classContainer.cpp Mon Mar 03 18:11:53 2014 +0900 +++ b/agent/src/classContainer.cpp Wed Mar 12 18:54:11 2014 +0900 @@ -1,7 +1,7 @@ /*! * \file classContainer.cpp * \brief This file is used to add up using size every class. - * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -136,7 +136,7 @@ try { /* Check classMap. */ - if (likely(classMap == NULL)) { + if (unlikely(classMap == NULL)) { throw 1; }
--- a/agent/src/trapSender.hpp Mon Mar 03 18:11:53 2014 +0900 +++ b/agent/src/trapSender.hpp Wed Mar 12 18:54:11 2014 +0900 @@ -1,7 +1,7 @@ /*! * \file trapSender.hpp * \brief This file is used to send SNMP trap. - * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -197,9 +197,9 @@ memset(&session, 0, sizeof(netsnmp_session)); snmp_sess_init(&session); session.version = snmp; - session.peername = pPeer; + session.peername = strdup(pPeer); session.remote_port = port; - session.community = (u_char*)pCommName; + session.community = (u_char*)strdup(pCommName); session.community_len = (pCommName != NULL) ? strlen(pCommName) : 0 ; @@ -225,7 +225,7 @@ if (pPdu != NULL) { snmp_free_pdu(pPdu); } - /* Close SNMP session. */ + /* Close and free SNMP session. */ snmp_close(&session); /* Unlock to use in multi-thread. */
--- a/agent/src/util.cpp Mon Mar 03 18:11:53 2014 +0900 +++ b/agent/src/util.cpp Wed Mar 12 18:54:11 2014 +0900 @@ -1,7 +1,7 @@ /*! * \file util.cpp * \brief This file is utilities. - * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -237,11 +237,17 @@ newArg->logSignalNormal = oldArg->logSignalNormal; newArg->logSignalAll = oldArg->logSignalAll; newArg->reloadSignal = oldArg->reloadSignal; + newArg->snmpSend &= oldArg->snmpSend; + newArg->snmpTarget = oldArg->snmpTarget; + newArg->snmpComName = oldArg->snmpComName; /* Swap setting. */ oldArg->logSignalNormal = swapArg.logSignalNormal; oldArg->logSignalAll = swapArg.logSignalAll; oldArg->reloadSignal = swapArg.reloadSignal; + oldArg->snmpSend &= swapArg.snmpSend; + oldArg->snmpTarget = swapArg.snmpTarget; + oldArg->snmpComName = swapArg.snmpComName; if (newArg->attach && (!oldArg->attach)) { /* Reset collected flag. */