]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: log: Don't use strftime() which can clobber timezone if chrooted
authorBenoit GARNIER <chezbunch+haproxy@gmail.com>
Sun, 27 Mar 2016 01:04:16 +0000 (03:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 17 Mar 2016 04:30:03 +0000 (05:30 +0100)
commite2e5bde3f2f5345438f4972667725be2ca9aa5e1
tree92108d6fb84c918eae511c0950df043cf548e149
parent15073a3393873349e04d41c69482391a4b86818f
BUG/MINOR: log: Don't use strftime() which can clobber timezone if chrooted

The strftime() function can call tzset() internally on some platforms.
When haproxy is chrooted, the /etc/localtime file is not found, and some
implementations will clobber the content of the current timezone.

The GMT offset is computed by diffing the times returned by gmtime_r() and
localtime_r(). These variants are guaranteed to not call tzset() and were
already used in haproxy while chrooted, so they should be safe.

This patch must be backported to 1.6 and 1.5.
include/common/standard.h
src/log.c
src/standard.c