From: Willy TARREAU Date: Wed, 1 Mar 2006 21:27:48 +0000 (+0100) Subject: * now we initialize the libc's localtime structures very early so X-Git-Tag: v1.2.9~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9e75f6effdcff9040c6e875624b040fbfe95e67;p=thirdparty%2Fhaproxy.git * now we initialize the libc's localtime structures very early so that even under OOM conditions, we can still send dated error messages without segfaulting. --- diff --git a/haproxy.c b/haproxy.c index 4c22aebef9..4cfa8ce635 100644 --- a/haproxy.c +++ b/haproxy.c @@ -7628,6 +7628,12 @@ void init(int argc, char **argv) { exit(1); } + /* initialize the libc's localtime structures once for all so that we + * won't be missing memory if we want to send alerts under OOM conditions. + */ + tv_now(&now); + localtime(&now.tv_sec); + /* initialize the log header encoding map : '{|}"#' should be encoded with * '#' as prefix, as well as non-printable characters ( <32 or >= 127 ). * URL encoding only requires '"', '#' to be encoded as well as non-