diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-08-31 16:57:07 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-08-31 16:57:07 -0700 |
commit | 486704db7c840dcfb51f70f1812d9c3ad37ad39c (patch) | |
tree | 971c4d4fe2657d683f59c10dfec7c103ab049550 /print-snmp.c | |
parent | 91579fe605d3a11491ba24f8eecc42c15c1f82b3 (diff) | |
download | tcpdump-486704db7c840dcfb51f70f1812d9c3ad37ad39c.tar.gz |
Avoid collison with error(), clean up code a bit.
Rename the variable to "error_status", as that's what it represents, and
as that doesn't collide with the error() function. Don't set it and
then not use the resulting value.
Diffstat (limited to 'print-snmp.c')
-rw-r--r-- | print-snmp.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/print-snmp.c b/print-snmp.c index 0636a1f9..f348cd3b 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -1297,7 +1297,7 @@ snmppdu_print(netdissect_options *ndo, u_short pduid, const u_char *np, u_int length) { struct be elem; - int count = 0, error; + int count = 0, error_status; /* reqId (Integer) */ if ((count = asn1_parse(ndo, np, length, &elem)) < 0) @@ -1320,7 +1320,7 @@ snmppdu_print(netdissect_options *ndo, asn1_print(ndo, &elem); return; } - error = 0; + error_status = 0; if ((pduid == GETREQ || pduid == GETNEXTREQ || pduid == SETREQ || pduid == INFORMREQ || pduid == V2TRAP || pduid == REPORT) && elem.data.integer != 0) { @@ -1332,7 +1332,7 @@ snmppdu_print(netdissect_options *ndo, } else if (elem.data.integer != 0) { char errbuf[20]; ND_PRINT((ndo, " %s", DECODE_ErrorStatus(elem.data.integer))); - error = elem.data.integer; + error_status = elem.data.integer; } length -= count; np += count; @@ -1352,15 +1352,12 @@ snmppdu_print(netdissect_options *ndo, else if (pduid == GETBULKREQ) ND_PRINT((ndo, " M=%d", elem.data.integer)); else if (elem.data.integer != 0) { - if (!error) + if (!error_status) ND_PRINT((ndo, "[errorIndex(%d) w/o errorStatus]", elem.data.integer)); - else { + else ND_PRINT((ndo, "@%d", elem.data.integer)); - error = elem.data.integer; - } - } else if (error) { + } else if (error_status) { ND_PRINT((ndo, "[errorIndex==0]")); - error = 0; } length -= count; np += count; |