]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stick-table: fix build error on 32-bit platforms
authorWilly Tarreau <w@1wt.eu>
Sun, 21 Jan 2024 07:21:35 +0000 (08:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 21 Jan 2024 07:21:35 +0000 (08:21 +0100)
Commit 9b2717e7b ("MINOR: stktable: use {show,set,clear} table with ptr")
stores a pointer in a long long (64bit), which fails the cas to void* on
32-bit platforms:

  src/stick_table.c: In function 'table_process_entry_per_ptr':
  src/stick_table.c:5136:37: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   5136 |         ts = stktable_lookup_ptr(t, (void *)ptr);

On all our supported platforms, longs and pointers are of the same size,
so let's just turn this to a ulong instead.

src/stick_table.c

index 26c0db21a0e0257f0cb8affccb068d29faee36c7..130b62da8d043c9f4eb17e1c54fcf31f31c719b0 100644 (file)
@@ -5121,7 +5121,7 @@ static int table_process_entry_per_ptr(struct appctx *appctx, char **args)
 {
        struct show_table_ctx *ctx = appctx->svcctx;
        struct stktable *t = ctx->target;
-       long long int ptr;
+       ulong ptr;
        char *error;
        struct stksess *ts;
 
@@ -5129,7 +5129,7 @@ static int table_process_entry_per_ptr(struct appctx *appctx, char **args)
                return cli_err(appctx, "Pointer expected (0xffff notation)\n");
 
        /* Convert argument to integer value */
-       ptr = strtoll(args[4], &error, 16);
+       ptr = strtoul(args[4], &error, 16);
        if (*error != '\0')
                return cli_err(appctx, "Malformed ptr.\n");