]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
Revert "BUG/MINOR: clock: fix a few occurrences of 'now' being used in place of ...
authorWilly Tarreau <w@1wt.eu>
Thu, 27 Apr 2023 16:12:06 +0000 (18:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 27 Apr 2023 16:14:57 +0000 (18:14 +0200)
This reverts commit aadcfc9ea6dce6ba800568067a45b879c8c5039e.

The parts affecting the DeviceAtlas addon were wrong actually, the
"now" variable was a local time_t in a file that's not compiled with
the haproxy binary (dadwsch). Only the fix to the calltrace is correct,
so better revert and fix the only one in a separate commit. No backport
is needed.

addons/deviceatlas/dadwsch.c
src/calltrace.c

index e0173cf5a139951a9c450067aa324397ea524300..e35566a3f4fb4b5fd00a68ac5ae1d4c920b98829 100644 (file)
@@ -44,7 +44,7 @@ static void dadwlog(dw_config_t cfg, const char* msg)
 {
        time_t now = time(NULL);
        char buf[26] = {0};
-       ctime_r(&date, buf);
+       ctime_r(&now, buf);
        buf[24] = 0;
        fprintf(stderr, "%s: %s\n", buf, msg);
 }
@@ -63,7 +63,7 @@ static dw_status_t dadwnot(void *a, dw_config_t *cfg)
        jsond = da_getdatacreation(&o->atlas);
        dwgetfinalp(o->dcfg.info, atlasp, sizeof(atlasp));
        ctime_r(&jsond, jsondbuf);
-       ctime_r(&date, buf);
+       ctime_r(&now, buf);
        jsondbuf[24] = 0;
        buf[24] = 0;
 
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
 
        if (!dset) {
                time_t now = time(NULL);
-               struct tm *cnow = gmtime(&date);
+               struct tm *cnow = gmtime(&now);
                memcpy(&global_deviceatlassch.o.dcfg.info.rtm, cnow, offsetof(struct tm, tm_mday));
        }
 
index 3946b286eee3660cdd3d264c797ed4fa76fbdbd0..f72e12116e590b1e578ce7dca913b87e657daaea 100644 (file)
@@ -76,7 +76,7 @@ static int open_trace()
        if (!log)
                log = stderr;
 
-       now_ptr = &date;
+       now_ptr = &now;
        if (getenv("HAPROXY_TRACE_FAST") != NULL) {
                fast_time = 1;
                now_ptr = &trace_now;