Skip to content

Commit 54d5fbe

Browse files
dag-erlingfxlb
authored andcommitted
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.
1 parent 262e119 commit 54d5fbe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tcpdump.c

+7
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,13 @@ main(int argc, char **argv)
15751575
if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
15761576
error("%s", ebuf);
15771577

1578+
/*
1579+
* An explicit tzset() call is usually not needed as it happens
1580+
* implicitly the first time we call localtime() or mktime(),
1581+
* but in some cases (sandboxing, chroot) this may be too late.
1582+
*/
1583+
tzset();
1584+
15781585
while (
15791586
(op = getopt_long(argc, argv, SHORTOPTS, longopts, NULL)) != -1)
15801587
switch (op) {

0 commit comments

Comments
 (0)