Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Initialize tzcode early.
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 54d5fbe)
  • Loading branch information
dag-erling authored and fxlb committed Nov 20, 2023
1 parent f8854fd commit b9437c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tcpdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,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) {
Expand Down

0 comments on commit b9437c4

Please sign in to comment.