From: scmi <schmidt.msmich...@siemens.com>

Implements a temporary variable 'command' which saves the value of the 
command-pointer before modifications for a later value check.

Signed-off-by: Michael Schmidt <schmidt.msmich...@siemens.com>
---
 agent/snmp_agent.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
index 9913a968e1..c728059ac8 100644
--- a/agent/snmp_agent.c
+++ b/agent/snmp_agent.c
@@ -1908,6 +1908,8 @@ netsnmp_wrap_up_request(netsnmp_agent_session *asp, int 
status)
     }
 
     if (asp->pdu) {
+       int command = asp->pdu->command;
+
         /*
          * If we've got an error status, then this needs to be
          *  passed back up to the higher levels....
@@ -2030,7 +2032,7 @@ netsnmp_wrap_up_request(netsnmp_agent_session *asp, int 
status)
         if (status == SNMP_ERR_NOERROR)
             snmp_increment_statistic_by(
 #ifndef NETSNMP_NO_WRITE_SUPPORT
-                (asp->pdu->command == SNMP_MSG_SET ?
+                (command == SNMP_MSG_SET ?
                  STAT_SNMPINTOTALSETVARS : STAT_SNMPINTOTALREQVARS),
 #else
                 STAT_SNMPINTOTALREQVARS,
-- 
2.39.5



_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to