]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-snmp.c
Squelch a Coverity warning.
[tcpdump] / print-snmp.c
index 0636a1f9928ff17491f5f476a5b9558aadba5753..a2aa0742d201fb5b14a06d56b28d52eafa413105 100644 (file)
@@ -60,7 +60,7 @@
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -69,7 +69,7 @@
 #include <smi.h>
 #endif
 
-#include "interface.h"
+#include "netdissect.h"
 
 #undef OPAQUE  /* defined in <wingdi.h> */
 
@@ -679,7 +679,7 @@ asn1_print(netdissect_options *ndo,
                int o = 0, first = -1;
 
                i = asnlen;
-               if (!ndo->ndo_sflag && !ndo->ndo_nflag && asnlen > 2) {
+               if (!ndo->ndo_mflag && !ndo->ndo_nflag && asnlen > 2) {
                        const struct obj_abrev *a = &obj_abrev_list[0];
                        size_t a_len = strlen(a->oid);
                        for (; a->node; a++) {
@@ -695,7 +695,7 @@ asn1_print(netdissect_options *ndo,
                        }
                }
 
-               for (; !ndo->ndo_sflag && i-- > 0; p++) {
+               for (; !ndo->ndo_mflag && i-- > 0; p++) {
                        ND_TCHECK(*p);
                        o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
                        if (*p & ASN_LONGLEN)
@@ -901,7 +901,7 @@ smi_decode_oid(netdissect_options *ndo,
        int o = 0, first = -1, i = asnlen;
        unsigned int firstval;
 
-       for (*oidlen = 0; ndo->ndo_sflag && i-- > 0; p++) {
+       for (*oidlen = 0; ndo->ndo_mflag && i-- > 0; p++) {
                ND_TCHECK(*p);
                o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
                if (*p & ASN_LONGLEN)
@@ -1054,7 +1054,7 @@ smi_print_variable(netdissect_options *ndo,
 
 static int
 smi_print_value(netdissect_options *ndo,
-                SmiNode *smiNode, u_char pduid, struct be *elem)
+                SmiNode *smiNode, u_short pduid, struct be *elem)
 {
        unsigned int i, oid[128], oidlen;
        SmiType *smiType;
@@ -1197,7 +1197,7 @@ smi_print_value(netdissect_options *ndo,
  */
 static void
 varbind_print(netdissect_options *ndo,
-              u_char pduid, const u_char *np, u_int length)
+              u_short pduid, const u_char *np, u_int length)
 {
        struct be elem;
        int count = 0, ind;
@@ -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;