]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Squelch a warning on some platforms.
authorGuy Harris <[email protected]>
Fri, 31 Aug 2018 06:42:53 +0000 (23:42 -0700)
committerGuy Harris <[email protected]>
Fri, 31 Aug 2018 06:42:53 +0000 (23:42 -0700)
Some platforms define the old V7 routine index() (renamed to strchr() in
System V; the latter name is what's used in ANSI C), and you get
"declaration of 'index' shadows a global declaration" warnings.

Call the variable if_index instead.

print-sll.c

index 17e9c7503a3d2042033f6a6ca091c7fe4711340d..56b9714d2114f12f07a87ac4937a80ac7c5b0c5d 100644 (file)
@@ -400,7 +400,7 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
        int llc_hdrlen;
        u_int hdrlen;
 #ifdef HAVE_NET_IF_H
-       uint32_t index;
+       uint32_t if_index;
        char ifname[IF_NAMESIZE];
 #endif
 
@@ -417,11 +417,11 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
 
        sllp = (const struct sll2_header *)p;
 #ifdef HAVE_NET_IF_H
-       index = EXTRACT_BE_U_4(sllp->sll2_if_index);
-       if (if_indextoname(index, ifname))
-               ND_PRINT("ifindex %u (%s) ", index, ifname);
+       if_index = EXTRACT_BE_U_4(sllp->sll2_if_index);
+       if (if_indextoname(if_index, ifname))
+               ND_PRINT("ifindex %u (%s) ", if_index, ifname);
        else
-               ND_PRINT("ifindex %u ", index);
+               ND_PRINT("ifindex %u ", if_index);
 #endif
 
        if (ndo->ndo_eflag)