]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Squelch a compiler warning.
authorGuy Harris <[email protected]>
Mon, 27 Jun 2016 01:02:12 +0000 (18:02 -0700)
committerGuy Harris <[email protected]>
Mon, 27 Jun 2016 01:02:12 +0000 (18:02 -0700)
It may not be necessary, but it makes the code a bit cleaner, even if
you spend a few extra microseconds per file fetching the name of the
link-layer header type even if the new file has the same header type.

tcpdump.c

index 3d491c4e9315341c3b6a914878ff46a130fb3e2f..1db35daafd5837f6a26ada69e1d6d5d06d593da8 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1849,7 +1849,6 @@ main(int argc, char **argv)
                                         */
                                        dlt = new_dlt;
                                        ndo->ndo_if_printer = get_if_printer(ndo, dlt);
-                                       dlt_name = pcap_datalink_val_to_name(dlt);
                                        if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
                                                error("%s", pcap_geterr(pd));
                                }
@@ -1863,6 +1862,7 @@ main(int argc, char **argv)
                                /*
                                 * Report the new file.
                                 */
+                               dlt_name = pcap_datalink_val_to_name(dlt);
                                if (dlt_name == NULL) {
                                        fprintf(stderr, "reading from file %s, link-type %u\n",
                                            RFileName, dlt);