X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/879d7ab968aa5afa2975904d7ca0e964592d3651..1f563c19e77e7be5e1a2e3b6336d0475d7530f61:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index 633d4812..c657707f 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -38,7 +38,7 @@ #endif /* - * Some older versions of Mac OS X may ship pcap.h from libpcap 0.6 with a + * Some older versions of Mac OS X ship pcap.h from libpcap 0.6 with a * libpcap based on 0.8. That means it has pcap_findalldevs() but the * header doesn't define pcap_if_t, meaning that we can't actually *use* * pcap_findalldevs(). @@ -1560,6 +1560,13 @@ main(int argc, char **argv) if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0) error("%s", ebuf); + /* + * An explicit tzset() call is usually not needed as it happens + * implicitly the first time we call localtime() or mktime(), + * but in some cases (sandboxing, chroot) this may be too late. + */ + tzset(); + while ( (op = getopt_long(argc, argv, SHORTOPTS, longopts, NULL)) != -1) switch (op) { @@ -2236,8 +2243,11 @@ main(int argc, char **argv) * on; this may be a non-Linux "any" device * that doesn't support DLT_LINUX_SLL2. */ - if (strcmp(device, "any") == 0) + if (strcmp(device, "any") == 0) { +DIAG_OFF_WARN_UNUSED_RESULT (void) pcap_set_datalink(pd, DLT_LINUX_SLL2); +DIAG_ON_WARN_UNUSED_RESULT + } } #endif i = pcap_snapshot(pd);