]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
* now we initialize the libc's localtime structures very early so
authorWilly TARREAU <willy@pcw.(none)>
Wed, 1 Mar 2006 21:27:48 +0000 (22:27 +0100)
committerWilly TARREAU <willy@pcw.(none)>
Wed, 1 Mar 2006 21:27:48 +0000 (22:27 +0100)
  that even under OOM conditions, we can still send dated error
  messages without segfaulting.

haproxy.c

index 4c22aebef92bd54780851d948fc12a03a6db5e44..4cfa8ce635b472eb1591ac0f7e63767af9b1d881 100644 (file)
--- 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-