X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/4c5bef9603c8acb00bd458c2a3b044911a1ef80a..b84bd2b4b55067d1eea6181e1a09043ac093d48c:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index d8c49432..28f68077 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -157,7 +157,6 @@ The Regents of the University of California. All rights reserved.\n"; #include "netdissect.h" #include "interface.h" #include "addrtoname.h" -#include "machdep.h" #include "pcap-missing.h" #include "ascii_strcasecmp.h" @@ -1567,16 +1566,6 @@ main(int argc, char **argv) error("Attempting to initialize Winsock failed"); #endif - /* - * On platforms where the CPU doesn't support unaligned loads, - * force unaligned accesses to abort with SIGBUS, rather than - * being fixed up (slowly) by the OS kernel; on those platforms, - * misaligned accesses are bugs, and we want tcpdump to crash so - * that the bugs are reported. - */ - 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(), @@ -1751,7 +1740,7 @@ main(int argc, char **argv) case 'h': print_usage(stdout); exit_tcpdump(S_SUCCESS); - break; + /* NOTREACHED */ case 'H': ++ndo->ndo_Hflag; @@ -1999,7 +1988,7 @@ main(int argc, char **argv) case OPTION_VERSION: print_version(stdout); exit_tcpdump(S_SUCCESS); - break; + /* NOTREACHED */ #ifdef HAVE_PCAP_SET_TSTAMP_PRECISION case OPTION_TSTAMP_PRECISION: @@ -2079,7 +2068,7 @@ main(int argc, char **argv) default: /* Not supported */ error("only -t, -tt, -ttt, -tttt and -ttttt are supported"); - break; + /* NOTREACHED */ } if (ndo->ndo_fflag != 0 && (VFileName != NULL || RFileName != NULL)) @@ -2390,7 +2379,21 @@ DIAG_ON_WARN_UNUSED_RESULT #endif /* Cooperate with nohup(1) */ #ifndef _WIN32 + /* + * In illumos /usr/include/sys/iso/signal_iso.h causes Clang to + * generate a -Wstrict-prototypes warning here, see [1]. The + * __illumos__ macro is available since at least GCC 11 and Clang 13, + * see [2]. + * 1: https://www.illumos.org/issues/16344 + * 2: https://www.illumos.org/issues/13726 + */ +#ifdef __illumos__ + DIAG_OFF_STRICT_PROTOTYPES +#endif /* __illumos__ */ if ((oldhandler = setsignal(SIGHUP, cleanup)) != SIG_DFL) +#ifdef __illumos__ + DIAG_ON_STRICT_PROTOTYPES +#endif /* __illumos__ */ (void)setsignal(SIGHUP, oldhandler); #endif /* _WIN32 */ @@ -2827,7 +2830,14 @@ static void ) new.sa_flags = SA_RESTART; if (sigaction(sig, &new, &old) < 0) + /* The same workaround as for SIG_DFL above. */ +#ifdef __illumos__ + DIAG_OFF_STRICT_PROTOTYPES +#endif /* __illumos__ */ return (SIG_ERR); +#ifdef __illumos__ + DIAG_ON_STRICT_PROTOTYPES +#endif /* __illumos__ */ return (old.sa_handler); #endif } @@ -3331,6 +3341,8 @@ print_version(FILE *f) (void)fprintf (f, "Compiled with MemorySanitizer/Clang.\n"); # endif #endif /* __SANITIZE_ADDRESS__ or __has_feature */ + (void)fprintf (f, "%zu-bit build, %zu-bit time_t\n", + sizeof(void *) * 8, sizeof(time_t) * 8); } DIAG_ON_DEPRECATION @@ -3344,10 +3356,8 @@ print_usage(FILE *f) "\t\t[ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]\n"); (void)fprintf(f, "\t\t[ -i interface ]" IMMEDIATE_MODE_USAGE j_FLAG_USAGE "\n"); -#ifdef HAVE_PCAP_FINDALLDEVS_EX (void)fprintf(f, "\t\t[ --lengths ]" LIST_REMOTE_INTERFACES_USAGE "\n"); -#endif #ifdef USE_LIBSMI (void)fprintf(f, "\t\t" m_FLAG_USAGE "\n");