kamailio: add patch fixing fragile kamcmd
[feed/telephony.git] / net / kamailio / patches / 160-siputils-fix-time_t-warning-and-a-typo.patch
1 From f32e1d9c96f6ba9df3c27178c689ccd27eabaafc Mon Sep 17 00:00:00 2001
2 From: Sebastian Kemper <sebastian_ml@gmx.net>
3 Date: Sun, 16 Oct 2022 16:51:41 +0200
4 Subject: [PATCH] siputils: fix time_t warning and a typo
5
6 Fix the below warning one gets when compiling siputils for a 32 bit
7 target against a time64 libc (musl).
8
9 Also fix a spelling mistake on the same line ("autdated" -> "outdated").
10
11 siputils.c: In function 'ki_hdr_date_check':
12 ../../core/parser/../dprint.h:321:73: warning: format '%ld' expects argument of type 'long int', but argument 11 has type 'time_t' {aka 'long long int'} [-Wformat=]
13 321 | fprintf(stderr, "%2d(%d) %s: %.*s%s%s%s" fmt, \
14 | ^~~~~~~~~~~~~~~~~~~~~~~~
15 ../../core/parser/../dprint.h:345:25: note: in expansion of macro 'LOG_FX'
16 345 | LOG_FX(facility, level, lname, prefix, _FUNC_NAME_, fmt, ## args)
17 | ^~~~~~
18 ../../core/parser/../dprint.h:351:25: note: in expansion of macro 'LOG_FL'
19 351 | LOG_FL(facility, level, NULL, prefix, fmt, ## args)
20 | ^~~~~~
21 ../../core/parser/../dprint.h:354:25: note: in expansion of macro 'LOG_FP'
22 354 | LOG_FP(DEFAULT_FACILITY, (level), LOC_INFO, fmt, ## args)
23 | ^~~~~~
24 ../../core/parser/../dprint.h:392:37: note: in expansion of macro 'LOG'
25 392 | # define ERR(fmt, args...) LOG(L_ERR, fmt , ## args)
26 | ^~~
27 ../../core/parser/../dprint.h:418:16: note: in expansion of macro 'ERR'
28 418 | #define LM_ERR ERR
29 | ^~~
30 siputils.c:562:17: note: in expansion of macro 'LM_ERR'
31 562 | LM_ERR("autdated date header value (%ld sec)\n", tnow - tmsg + tdiff);
32 | ^~~~~~
33
34 Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
35 ---
36 src/modules/siputils/siputils.c | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39 --- a/src/modules/siputils/siputils.c
40 +++ b/src/modules/siputils/siputils.c
41 @@ -559,7 +559,7 @@ static int ki_hdr_date_check(sip_msg_t*
42 }
43
44 if (tnow > tmsg + tdiff) {
45 - LM_ERR("autdated date header value (%ld sec)\n", tnow - tmsg + tdiff);
46 + LM_ERR("outdated date header value (%" TIME_T_FMT " sec)\n", TIME_T_CAST(tnow - tmsg + tdiff));
47 return -4;
48 } else {
49 LM_ERR("Date header value OK\n");