From: Dag-Erling Smørgrav Date: Sat, 16 Sep 2023 09:02:46 +0000 (+0200) Subject: Initialize tzcode early. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/54d5fbec2c52d2e04cb549caa0a811ab1da5aa56 Initialize tzcode early. 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. --- diff --git a/tcpdump.c b/tcpdump.c index a7a97fff..a7756be5 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -1575,6 +1575,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) {