BUG/MINOR: stick-table: fix several printf sign errors dumping tables
authorEmeric Brun <ebrun@haproxy.com>
Wed, 30 Jun 2021 14:24:04 +0000 (16:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Jul 2021 15:51:10 +0000 (17:51 +0200)
This patch fixes several errors printing integers
of stick table entry values and args during dump on cli.

This patch should be backported since the dump of entries
is supported.  [wt: roughly 1.5-dev1 hence all stable branches]

(cherry picked from commit 01928ae56b0296e5312eca195a4e155d6e8d79d0)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit c24b414034d4b7f848ba37ac0a6fe28271375b4b)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/stick_table.c

index 775a3af..b1288eb 100644 (file)
@@ -3392,7 +3392,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
                if (t->data_ofs[dt] == 0)
                        continue;
                if (stktable_data_types[dt].arg_type == ARG_T_DELAY)
-                       chunk_appendf(msg, " %s(%d)=", stktable_data_types[dt].name, t->data_arg[dt].u);
+                       chunk_appendf(msg, " %s(%u)=", stktable_data_types[dt].name, t->data_arg[dt].u);
                else
                        chunk_appendf(msg, " %s=", stktable_data_types[dt].name);
 
@@ -3405,10 +3405,10 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
                        chunk_appendf(msg, "%u", stktable_data_cast(ptr, std_t_uint));
                        break;
                case STD_T_ULL:
-                       chunk_appendf(msg, "%lld", stktable_data_cast(ptr, std_t_ull));
+                       chunk_appendf(msg, "%llu", stktable_data_cast(ptr, std_t_ull));
                        break;
                case STD_T_FRQP:
-                       chunk_appendf(msg, "%d",
+                       chunk_appendf(msg, "%u",
                                     read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                          t->data_arg[dt].u));
                        break;