]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: cli: fix build on Windows due to isalnum() implemented as a macro
authorWilly Tarreau <w@1wt.eu>
Wed, 3 May 2023 14:28:54 +0000 (16:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 May 2023 14:32:50 +0000 (16:32 +0200)
Commit 986798718 ("DEBUG: cli: add "debug dev task" to show/wake/expire/kill
tasks and tasklets") broke the build on windows due to this:

  src/debug.c:940:95: error: array subscript has type char [-Werror=char-subscripts]
    940 |  caller && may_access(caller) && may_access(caller->func) && isalnum(*caller->func) ? caller->func : "0",
        |                                                                      ^~~~~~~~~~~~~

It's classical on platforms which implement ctype.h as macros instead of
functions, let's cast it as uchar. No backport is needed.

src/debug.c

index b196fec244613a0f3ae627326806108cec02d655..a68c45df75595a7ee8dbedd0f20d62a14c97a3a4 100644 (file)
@@ -937,7 +937,7 @@ static int debug_parse_cli_task(char **args, char *payload, struct appctx *appct
                memprintf(&msg, "%s%p: %s state=%#x tid=%d process=%s ctx=%p calls=%d last=%s:%d intl=%d",
                          msg ? msg : "", t, (t->state & TASK_F_TASKLET) ? "tasklet" : "task",
                          t->state, t->tid, trash.area, t->context, t->calls,
-                         caller && may_access(caller) && may_access(caller->func) && isalnum(*caller->func) ? caller->func : "0",
+                         caller && may_access(caller) && may_access(caller->func) && isalnum((uchar)*caller->func) ? caller->func : "0",
                          caller ? t->caller->line : 0,
                          (t->state & TASK_F_TASKLET) ? LIST_INLIST(&((const struct tasklet *)t)->list) : 0);