From: Willy Tarreau Date: Wed, 21 May 2025 08:18:47 +0000 (+0200) Subject: BUILD: acme: fix build issue on 32-bit archs with 64-bit time_t X-Git-Tag: v3.2-dev17~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b52d5e4066fa704484ccc15dca312289834d50c;p=thirdparty%2Fhaproxy.git BUILD: acme: fix build issue on 32-bit archs with 64-bit time_t The build failed on mips32 with a 64-bit time_t here: https://github.com/haproxy/haproxy/actions/runs/15150389164/job/42595310111 Let's just turn the "remain" variable used to show the remaining time into a more portable ullong and use %llu for all format specifiers, since long remains limited to 32-bit on 32-bit archs. No backport needed. --- diff --git a/src/acme.c b/src/acme.c index 70bd95e8e..a1197f3b7 100644 --- a/src/acme.c +++ b/src/acme.c @@ -2394,7 +2394,7 @@ static int cli_acme_status_io_handler(struct appctx *appctx) char *state; time_t notAfter = 0; time_t sched = 0; - time_t remain = 0; + ullong remain = 0; int running = !!store->acme_task; if (global_ssl.acme_scheduler) @@ -2413,7 +2413,7 @@ static int cli_acme_status_io_handler(struct appctx *appctx) remain = notAfter - date.tv_sec; strftime(str, sizeof(str), "%Y-%m-%dT%H:%M:%SZ", gmtime(¬After)); chunk_appendf(&trash, "%s\t", str); - chunk_appendf(&trash, "%lud %luh%02lum%02lus\t", remain / 86400, (remain % 86400) / 3600, (remain % 3600) / 60, (remain % 60)); + chunk_appendf(&trash, "%llud %lluh%02llum%02llus\t", remain / 86400, (remain % 86400) / 3600, (remain % 3600) / 60, (remain % 60)); /* Scheduled time */ remain = 0; @@ -2424,7 +2424,7 @@ static int cli_acme_status_io_handler(struct appctx *appctx) strftime(str, sizeof(str), "%Y-%m-%dT%H:%M:%SZ", gmtime(&sched)); chunk_appendf(&trash, "%s\t", sched ? str : "-"); if (sched) - chunk_appendf(&trash, "%lud %luh%02lum%02lus\n", remain / 86400, (remain % 86400) / 3600, (remain % 3600) / 60, (remain % 60)); + chunk_appendf(&trash, "%llud %lluh%02llum%02llus\n", remain / 86400, (remain % 86400) / 3600, (remain % 3600) / 60, (remain % 60)); else chunk_appendf(&trash, "%s\n", "-");