]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Update --version option to print 32/64-bit build and time_t size
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 13 Mar 2024 12:11:06 +0000 (13:11 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 22 Mar 2024 10:20:29 +0000 (11:20 +0100)
Use only sizeof() and not SIZEOF_VOID_P/SIZEOF_TIME_T because these
macros could have invalid values in some macOS fat builds (See commit
e9c0bfe6d209e3e95e3da7204d1b88670ac95c3d).

This method should be future proof.

With this change we know:
whether this is a 32-bit or 64-bit build;
whether the time_t size is 32-bit or 64-bit.

(cherry picked from commit 218a378a6fb336b226ed0100efc37f4214c96068)

[skip ci]

tcpdump.c

index c657707fbb40019ebecdfa09f2a583af82ff3b0b..adb5d4697368e576aae22c2b931090dedae7c476 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -3242,6 +3242,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