mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-05 22:56:57 +02:00
MINOR: stktable: fix potential build issue in smp_to_stkey (2nd try)
As discussed in GH #2838, the previous fixf399dbf
("MINOR: stktable: fix potential build issue in smp_to_stkey") which attempted to remove conversion ambiguity and prevent build warning proved to be insufficient. This time, we implement Willy's suggestion, which is to use an union to perform the conversion. Hopefully this should fix GH #2838. If that's the case (and only in that case), then this patch may be backported withf399dbf
(else the patch won't apply) anywhereb59d1fd
("BUG/MINOR: stktable: fix big-endian compatiblity in smp_to_stkey()") was backported.
This commit is contained in:
parent
91578212d7
commit
0fb8807820
@ -1495,13 +1495,19 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t)
|
||||
|
||||
case SMP_T_SINT:
|
||||
{
|
||||
uint *_sint = (uint *)&smp->data.u.sint;
|
||||
union {
|
||||
uint32_t u32;
|
||||
int64_t s64;
|
||||
} conv;
|
||||
|
||||
/* The stick table require a 32bit unsigned int, "sint" is a
|
||||
* signed 64 it, so we can convert it inplace.
|
||||
*/
|
||||
*_sint = (uint)smp->data.u.sint;
|
||||
static_table_key.key = _sint;
|
||||
conv.s64 = 0;
|
||||
conv.u32 = smp->data.u.sint;
|
||||
smp->data.u.sint = conv.s64;
|
||||
|
||||
static_table_key.key = &smp->data.u.sint;
|
||||
static_table_key.key_len = 4;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user