X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/705725c2475acfc5ee17c9bfdd96a64185959461..1f563c19e77e7be5e1a2e3b6336d0475d7530f61:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index 7cdbd8af..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(). @@ -808,7 +808,7 @@ droproot(const char *username, const char *chroot_dir) } else error("Couldn't find user '%.32s'", username); #ifdef HAVE_LIBCAP_NG - /* We don't need CAP_SETUID, CAP_SETGID and CAP_SYS_CHROOT any more. */ + /* We don't need CAP_SETUID, CAP_SETGID and CAP_SYS_CHROOT anymore. */ DIAG_OFF_ASSIGN_ENUM capng_updatev( CAPNG_DROP, @@ -979,7 +979,7 @@ tstamp_precision_to_string(int precision) * along the lines of ioctl(), the fact that ioctl() operations are * largely specific to particular character devices but fcntl() operations * are either generic to all descriptors or generic to all descriptors for - * regular files nonwithstanding. + * regular files notwithstanding. * * The Capsicum people decided that fine-grained control of descriptor * operations was required, so that you need to grant permission for @@ -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) { @@ -1728,7 +1735,7 @@ main(int argc, char **argv) if (nd_load_smi_module(optarg, ebuf, sizeof(ebuf)) == -1) error("%s", ebuf); } else { - (void)fprintf(stderr, "%s: ignoring option `-m %s' ", + (void)fprintf(stderr, "%s: ignoring option '-m %s' ", program_name, optarg); (void)fprintf(stderr, "(no libsmi support)\n"); } @@ -1772,7 +1779,7 @@ main(int argc, char **argv) else if (ascii_strcasecmp(optarg, "inout") == 0) Qflag = PCAP_D_INOUT; else - error("unknown capture direction `%s'", optarg); + error("unknown capture direction '%s'", optarg); break; #endif /* HAVE_PCAP_SETDIRECTION */ @@ -1838,7 +1845,7 @@ main(int argc, char **argv) else if (ascii_strcasecmp(optarg, "domain") == 0) ndo->ndo_packettype = PT_DOMAIN; else - error("unknown packet type `%s'", optarg); + error("unknown packet type '%s'", optarg); break; case 'u': @@ -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);