git: 7e0a7ef95fac - main - tcpdump: Initialize tzcode early.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Fri, 15 Sep 2023 21:36:51 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=7e0a7ef95fac1183854cab662bd9afa4647422d6

commit 7e0a7ef95fac1183854cab662bd9afa4647422d6
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-09-15 21:36:41 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-09-15 21:36:41 +0000

    tcpdump: 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.
    
    PR:             273807
    MFC after:      3 days
    Reviewed by:    jrm
    Differential Revision:  https://reviews.freebsd.org/D41880
---
 contrib/tcpdump/tcpdump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 52209fedb999..8cfcb04fc093 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -1564,6 +1564,8 @@ main(int argc, char **argv)
 	if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
 		error("%s", ebuf);
 
+	tzset();
+
 	while (
 	    (op = getopt_long(argc, argv, SHORTOPTS, longopts, NULL)) != -1)
 		switch (op) {