kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
May 2020
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
24 participants
393 discussions
Start a n
N
ew thread
git:master:259af0c1: sipdump: use localtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 259af0c1eea8419df247c8da0f12b1881afa5332 URL:
https://github.com/kamailio/kamailio/commit/259af0c1eea8419df247c8da0f12b18…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:32:31+02:00 sipdump: use localtime_r() for a safer multi-thread usage --- Modified: src/modules/sipdump/sipdump_write.c --- Diff:
https://github.com/kamailio/kamailio/commit/259af0c1eea8419df247c8da0f12b18…
Patch:
https://github.com/kamailio/kamailio/commit/259af0c1eea8419df247c8da0f12b18…
--- diff --git a/src/modules/sipdump/sipdump_write.c b/src/modules/sipdump/sipdump_write.c index 03ed711d81..29face97c4 100644 --- a/src/modules/sipdump/sipdump_write.c +++ b/src/modules/sipdump/sipdump_write.c @@ -137,7 +137,8 @@ static int sipdump_write_meta(char *fpath) int len; int i; FILE *mfile = NULL; - struct tm *ti; + struct tm ti; + char t_buf[26] = {0}; len = strlen(fpath); if(len>=SIPDUMP_FPATH_SIZE-1) { @@ -156,14 +157,14 @@ static int sipdump_write_meta(char *fpath) LM_ERR("failed to open meta file %s\n", mpath); return -1; } - ti = localtime(&up_since); + localtime_r(&up_since, &ti); fprintf(mfile, "v: 1.0\n" "version: %s %s\n" "start: %s" "nrprocs: %d\n", ver_name, ver_version, - asctime(ti), + asctime_r(&ti, t_buf), *process_count ); for (i=0; i<*process_count; i++) { @@ -182,7 +183,7 @@ static int sipdump_write_meta(char *fpath) static int sipdump_rotate_file(void) { time_t tv; - struct tm *ti = NULL; + struct tm ti; int n; tv = time(NULL); @@ -197,12 +198,12 @@ static int sipdump_rotate_file(void) if(_sipdump_file != NULL) { fclose(_sipdump_file); } - ti = localtime(&tv); + localtime_r(&tv, &ti); n = snprintf(_sipdump_fpath+_sipdump_fpath_prefix.len, SIPDUMP_FPATH_SIZE-_sipdump_fpath_prefix.len, "%d-%02d-%02d--%02d-%02d-%02d.data", - 1900+ti->tm_year, ti->tm_mon, ti->tm_mday, - ti->tm_hour, ti->tm_min, ti->tm_sec); + 1900+ti.tm_year, ti.tm_mon, ti.tm_mday, + ti.tm_hour, ti.tm_min, ti.tm_sec); LM_DBG("writing to file: %s (%d)\n", _sipdump_fpath, n); _sipdump_file = fopen( _sipdump_fpath, "w" ); if(_sipdump_file==NULL) {
4 years, 7 months
1
0
0
0
git:master:92e2c22c: tmrec: use localtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 92e2c22c3c709c3c9a5243b5d5bdd48293865b0c URL:
https://github.com/kamailio/kamailio/commit/92e2c22c3c709c3c9a5243b5d5bdd48…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:27:58+02:00 tmrec: use localtime_r() for a safer multi-thread usage --- Modified: src/modules/tmrec/tmrec_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/92e2c22c3c709c3c9a5243b5d5bdd48…
Patch:
https://github.com/kamailio/kamailio/commit/92e2c22c3c709c3c9a5243b5d5bdd48…
--- diff --git a/src/modules/tmrec/tmrec_mod.c b/src/modules/tmrec/tmrec_mod.c index 4bf21f9bad..cc97cc9b55 100644 --- a/src/modules/tmrec/tmrec_mod.c +++ b/src/modules/tmrec/tmrec_mod.c @@ -128,9 +128,9 @@ static void mod_destroy(void) static int w_is_leap_year(struct sip_msg* msg, char* t, char* str2) { time_t tv; - struct tm *tb; + struct tm tb; int y; - + if(msg==NULL) return -1; @@ -143,8 +143,8 @@ static int w_is_leap_year(struct sip_msg* msg, char* t, char* str2) } } else { tv = time(NULL); - tb = localtime(&tv); - y = 1900 + tb->tm_year; + localtime_r(&tv, &tb); + y = 1900 + tb.tm_year; } if(tr_is_leap_year(y)) @@ -155,12 +155,12 @@ static int w_is_leap_year(struct sip_msg* msg, char* t, char* str2) static int ki_is_leap_year_now(sip_msg_t* msg) { time_t tv; - struct tm *tb; + struct tm tb; int y; tv = time(NULL); - tb = localtime(&tv); - y = 1900 + tb->tm_year; + localtime_r(&tv, &tb); + y = 1900 + tb.tm_year; if(tr_is_leap_year(y)) return 1;
4 years, 7 months
1
0
0
0
git:master:19769eb3: pv: use ctime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 19769eb372ca4d37ed45fef561cf966360ea6fd4 URL:
https://github.com/kamailio/kamailio/commit/19769eb372ca4d37ed45fef561cf966…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:26:07+02:00 pv: use ctime_r() for a safer multi-thread usage --- Modified: src/modules/pv/pv_time.c --- Diff:
https://github.com/kamailio/kamailio/commit/19769eb372ca4d37ed45fef561cf966…
Patch:
https://github.com/kamailio/kamailio/commit/19769eb372ca4d37ed45fef561cf966…
--- diff --git a/src/modules/pv/pv_time.c b/src/modules/pv/pv_time.c index f3baccf6df..87b62b71e9 100644 --- a/src/modules/pv/pv_time.c +++ b/src/modules/pv/pv_time.c @@ -246,10 +246,12 @@ int pv_get_timenowf(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { str s; + char t_buf[26] = {0}; time_t t; t = time(NULL); - s.s = ctime(&t); + + s.s = ctime_r(&t, t_buf); s.len = strlen(s.s)-1; return pv_get_strintval(msg, param, res, &s, (int)t); } @@ -269,13 +271,14 @@ int pv_get_timef(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { str s; + char t_buf[26] = {0}; if(msg==NULL) return -1; msg_set_time(msg); - s.s = ctime(&msg->tval.tv_sec); + s.s = ctime_r(&msg->tval.tv_sec, t_buf); s.len = strlen(s.s)-1; return pv_get_strintval(msg, param, res, &s, (int)msg->tval.tv_sec); }
4 years, 7 months
1
0
0
0
git:master:f72cc60b: msilo: use [c|gm]time_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: f72cc60b9e82bc810c08d42a49bb23e5134ffa9d URL:
https://github.com/kamailio/kamailio/commit/f72cc60b9e82bc810c08d42a49bb23e…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:19:18+02:00 msilo: use [c|gm]time_r() for a safer multi-thread usage --- Modified: src/modules/msilo/msfuncs.c --- Diff:
https://github.com/kamailio/kamailio/commit/f72cc60b9e82bc810c08d42a49bb23e…
Patch:
https://github.com/kamailio/kamailio/commit/f72cc60b9e82bc810c08d42a49bb23e…
--- diff --git a/src/modules/msilo/msfuncs.c b/src/modules/msilo/msfuncs.c index 5262a81159..dd2f4762b7 100644 --- a/src/modules/msilo/msfuncs.c +++ b/src/modules/msilo/msfuncs.c @@ -93,24 +93,24 @@ int m_apo_escape(char* src, int slen, char* dst, int dlen) */ int timetToSipDateStr(time_t date, char* buf, int bufLen) { - struct tm *gmt; + struct tm gmt; char* dayArray[7] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; char* monthArray[12] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; int len = 0; - gmt = gmtime(&date); + gmtime_r(&date, &gmt); /* In RFC 3261 the format is always GMT and in the string form like * "Wkday, Day Month Year HOUR:MIN:SEC GMT" * "Mon, 19 Feb 2007 18:42:27 GMT" */ len = snprintf(buf,bufLen,"Date: %s, %02d %s %d %02d:%02d:%02d GMT\r\n", - dayArray[gmt->tm_wday], - gmt->tm_mday, - monthArray[gmt->tm_mon], - 1900 + gmt->tm_year, - gmt->tm_hour, - gmt->tm_min, - gmt->tm_sec + dayArray[gmt.tm_wday], + gmt.tm_mday, + monthArray[gmt.tm_mon], + 1900 + gmt.tm_year, + gmt.tm_hour, + gmt.tm_min, + gmt.tm_sec ); /* snprintf returns number of chars it should have printed, so you @@ -243,7 +243,7 @@ int m_build_headers(str *buf, str ctype, str contact, time_t date, str extra) return -1; } -/** build MESSAGE body --- add incoming time and 'from' +/** build MESSAGE body --- add incoming time and 'from' * * expects - max buf len of the resulted body in body->len * - body->s MUST be allocated @@ -252,11 +252,12 @@ int m_build_headers(str *buf, str ctype, str contact, time_t date, str extra) int m_build_body(str *body, time_t date, str msg, time_t sdate) { char *p; - + char t_buf[26] = {0}; + if(!body || !(body->s) || body->len <= 0 || msg.len <= 0 || date < 0 || msg.len < 0 || (46+msg.len > body->len) ) goto error; - + p = body->s; if(ms_add_date!=0) @@ -265,28 +266,28 @@ int m_build_body(str *body, time_t date, str msg, time_t sdate) { memcpy(p, "[Reminder message - ", 20); p += 20; - - memcpy(p, ctime(&sdate), 24); + ctime_r(&sdate, t_buf); + memcpy(p, t_buf, 24); p += 24; *p++ = ']'; } else { memcpy(p, "[Offline message - ", 19); p += 19; - - memcpy(p, ctime(&date), 24); + ctime_r(&date, t_buf); + memcpy(p, t_buf, 24); p += 24; *p++ = ']'; } *p++ = ' '; } - + memcpy(p, msg.s, msg.len); p += msg.len; body->len = p - body->s; - + return 0; error: return -1;
4 years, 7 months
1
0
0
0
git:master:2394c0a9: msrp: use ctime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 2394c0a97387efefde6a6784e09e02f3ff8a841c URL:
https://github.com/kamailio/kamailio/commit/2394c0a97387efefde6a6784e09e02f…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:14:39+02:00 msrp: use ctime_r() for a safer multi-thread usage --- Modified: src/modules/msrp/msrp_cmap.c --- Diff:
https://github.com/kamailio/kamailio/commit/2394c0a97387efefde6a6784e09e02f…
Patch:
https://github.com/kamailio/kamailio/commit/2394c0a97387efefde6a6784e09e02f…
--- diff --git a/src/modules/msrp/msrp_cmap.c b/src/modules/msrp/msrp_cmap.c index 0390173f91..9764c0903f 100644 --- a/src/modules/msrp/msrp_cmap.c +++ b/src/modules/msrp/msrp_cmap.c @@ -421,6 +421,7 @@ static void msrp_cmap_rpc_list(rpc_t* rpc, void* ctx) msrp_citem_t *it; int i; int n; + char t_buf[26] = {0}; str edate; if(_msrp_cmap_head==NULL) @@ -457,7 +458,8 @@ static void msrp_cmap_rpc_list(rpc_t* rpc, void* ctx) lock_release(&_msrp_cmap_head->cslots[i].lock); return; } - edate.s = ctime(&it->expires); + ctime_r(&it->expires, t_buf); + edate.s = t_buf; edate.len = 24; if(rpc->struct_add(vh, "dSSSSSdd", "CITEMID", it->citemid,
4 years, 7 months
1
0
0
0
git:master:0cdd35c7: acc: use localtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 0cdd35c7c685cf65687be12c23135be89728cbf3 URL:
https://github.com/kamailio/kamailio/commit/0cdd35c7c685cf65687be12c23135be…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:11:29+02:00 acc: use localtime_r() for a safer multi-thread usage --- Modified: src/modules/acc/acc.c --- Diff:
https://github.com/kamailio/kamailio/commit/0cdd35c7c685cf65687be12c23135be…
Patch:
https://github.com/kamailio/kamailio/commit/0cdd35c7c685cf65687be12c23135be…
--- diff --git a/src/modules/acc/acc.c b/src/modules/acc/acc.c index 9879e697ff..91a12f6cdb 100644 --- a/src/modules/acc/acc.c +++ b/src/modules/acc/acc.c @@ -195,7 +195,7 @@ int acc_log_request( struct sip_msg *rq) int m; int o; int i; - struct tm *t; + struct tm t; double dtime; /* get default values */ @@ -262,12 +262,12 @@ int acc_log_request( struct sip_msg *rq) acc_time_attr.s, dtime, log_msg); } else if(acc_time_mode==3 || acc_time_mode==4) { if(acc_time_mode==3) { - t = localtime(&acc_env.ts); + localtime_r(&acc_env.ts, &t); } else { - t = gmtime(&acc_env.ts); + gmtime_r(&acc_env.ts, &t); } if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, - acc_time_format, t)<=0) { + acc_time_format, &t)<=0) { acc_time_format_buf[0] = '\0'; } LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%s%s", @@ -412,7 +412,7 @@ int acc_db_request( struct sip_msg *rq) int n; int i; int o; - struct tm *t; + struct tm t; double dtime; /* formated database columns */ @@ -435,12 +435,12 @@ int acc_db_request( struct sip_msg *rq) i++; } else if(acc_time_mode==3 || acc_time_mode==4) { if(acc_time_mode==3) { - t = localtime(&acc_env.ts); + localtime_r(&acc_env.ts, &t); } else { - t = gmtime(&acc_env.ts); + gmtime_r(&acc_env.ts, &t); } if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, - acc_time_format, t)<=0) { + acc_time_format, &t)<=0) { acc_time_format_buf[0] = '\0'; } VAL_STRING(db_vals+(m++)) = acc_time_format_buf;
4 years, 7 months
1
0
0
0
git:master:a05d313e: sipdump: use localtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: a05d313e0fa27952d7b10329ca1da9b041369ffb URL:
https://github.com/kamailio/kamailio/commit/a05d313e0fa27952d7b10329ca1da9b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T16:08:21+02:00 sipdump: use localtime_r() for a safer multi-thread usage --- Modified: src/modules/sipdump/sipdump_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/a05d313e0fa27952d7b10329ca1da9b…
Patch:
https://github.com/kamailio/kamailio/commit/a05d313e0fa27952d7b10329ca1da9b…
--- diff --git a/src/modules/sipdump/sipdump_mod.c b/src/modules/sipdump/sipdump_mod.c index e61fea014d..a9868462e7 100644 --- a/src/modules/sipdump/sipdump_mod.c +++ b/src/modules/sipdump/sipdump_mod.c @@ -204,10 +204,11 @@ typedef struct sipdump_info { int sipdump_buffer_write(sipdump_info_t *sdi, str *obuf) { struct timeval tv; - struct tm *ti; + struct tm ti; + char t_buf[26] = {0}; gettimeofday(&tv, NULL); - ti = localtime(&tv.tv_sec); + localtime_r(&tv.tv_sec, &ti); obuf->len = snprintf(_sipdump_wbuf, SIPDUMP_WBUF_SIZE, "====================\n" "tag: %.*s\n" @@ -227,7 +228,7 @@ int sipdump_buffer_write(sipdump_info_t *sdi, str *obuf) my_pid(), process_no, (unsigned long)tv.tv_sec, (unsigned long)tv.tv_usec, - asctime(ti), + asctime_r(&ti, t_buf), sdi->proto.len, sdi->proto.s, sdi->af.len, sdi->af.s, sdi->src_ip.len, sdi->src_ip.s, sdi->src_port, sdi->dst_ip.len, sdi->dst_ip.s, sdi->dst_port,
4 years, 7 months
1
0
0
0
git:master:14aa67d7: xhttp_rpc: use gmtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 14aa67d750150cf6eb588b350ce156b770d4816d URL:
https://github.com/kamailio/kamailio/commit/14aa67d750150cf6eb588b350ce156b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T15:02:50+02:00 xhttp_rpc: use gmtime_r() for a safer multi-thread usage --- Modified: src/modules/xhttp_rpc/xhttp_rpc.c --- Diff:
https://github.com/kamailio/kamailio/commit/14aa67d750150cf6eb588b350ce156b…
Patch:
https://github.com/kamailio/kamailio/commit/14aa67d750150cf6eb588b350ce156b…
--- diff --git a/src/modules/xhttp_rpc/xhttp_rpc.c b/src/modules/xhttp_rpc/xhttp_rpc.c index e51ff838bf..b9269c294d 100644 --- a/src/modules/xhttp_rpc/xhttp_rpc.c +++ b/src/modules/xhttp_rpc/xhttp_rpc.c @@ -283,7 +283,7 @@ static int print_value(rpc_ctx_t* ctx, char fmt, va_list* ap, str *id) str *sp; char buf[PRINT_VALUE_BUF_LEN]; time_t dt; - struct tm* t; + struct tm t; switch(fmt) { case 'd': @@ -306,9 +306,9 @@ static int print_value(rpc_ctx_t* ctx, char fmt, va_list* ap, str *id) body.s = buf; body.len = sizeof("19980717T14:08:55") - 1; dt = va_arg(*ap, time_t); - t = gmtime(&dt); + gmtime_r(&dt, &t); if (strftime(buf, PRINT_VALUE_BUF_LEN, - "%Y%m%dT%H:%M:%S", t) == 0) { + "%Y%m%dT%H:%M:%S", &t) == 0) { LM_ERR("Error while converting time\n"); return -1; }
4 years, 7 months
1
0
0
0
git:master:c244381c: acc: use gmtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: c244381c69459b3708d3603e548fafac8321acf8 URL:
https://github.com/kamailio/kamailio/commit/c244381c69459b3708d3603e548fafa…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T14:59:13+02:00 acc: use gmtime_r() for a safer multi-thread usage --- Modified: src/modules/acc/acc_cdr.c --- Diff:
https://github.com/kamailio/kamailio/commit/c244381c69459b3708d3603e548fafa…
Patch:
https://github.com/kamailio/kamailio/commit/c244381c69459b3708d3603e548fafa…
--- diff --git a/src/modules/acc/acc_cdr.c b/src/modules/acc/acc_cdr.c index 7b052440e6..d59192156a 100644 --- a/src/modules/acc/acc_cdr.c +++ b/src/modules/acc/acc_cdr.c @@ -141,7 +141,7 @@ static int db_write_cdr( struct dlg_cell* dialog, long long_val; double double_val; char * end; - struct tm *t; + struct tm t; char cdr_time_format_buf[MAX_CDR_CORE][TIME_STR_BUFFER_SIZE]; if(acc_cdrs_table.len<=0) @@ -191,9 +191,9 @@ static int db_write_cdr( struct dlg_cell* dialog, } if (acc_time_mode==4) { VAL_TYPE(db_cdr_vals+i)=DB1_STRING; - t = gmtime(&timeval_val.tv_sec); + gmtime_r(&timeval_val.tv_sec, &t); /* Convert time_t structure to format accepted by the database */ - if (strftime(cdr_time_format_buf[i], TIME_STR_BUFFER_SIZE, TIME_STRING_FORMAT, t) <= 0) { + if (strftime(cdr_time_format_buf[i], TIME_STR_BUFFER_SIZE, TIME_STRING_FORMAT, &t) <= 0) { cdr_time_format_buf[i][0] = '\0'; }
4 years, 7 months
1
0
0
0
git:master:1fe9da8c: drouting: use localtime_r() for a safer multi-thread usage
by Victor Seva
Module: kamailio Branch: master Commit: 1fe9da8c118f2ff3ebe1913238b609500cca8f23 URL:
https://github.com/kamailio/kamailio/commit/1fe9da8c118f2ff3ebe1913238b6095…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2020-05-12T14:57:13+02:00 drouting: use localtime_r() for a safer multi-thread usage --- Modified: src/modules/drouting/dr_time.c --- Diff:
https://github.com/kamailio/kamailio/commit/1fe9da8c118f2ff3ebe1913238b6095…
Patch:
https://github.com/kamailio/kamailio/commit/1fe9da8c118f2ff3ebe1913238b6095…
--- diff --git a/src/modules/drouting/dr_time.c b/src/modules/drouting/dr_time.c index 0af2e51326..9e71ce7221 100644 --- a/src/modules/drouting/dr_time.c +++ b/src/modules/drouting/dr_time.c @@ -130,10 +130,12 @@ int ac_tm_fill(ac_tm_p _atp, struct tm *_tm) int ac_tm_set_time(ac_tm_p _atp, time_t _t) { + struct tm _tm; if(!_atp) return -1; _atp->time = _t; - return ac_tm_fill(_atp, localtime(&_t)); + localtime_r(&_t, &_tm); + return ac_tm_fill(_atp, &_tm); } int ac_get_mweek(struct tm *_tm)
4 years, 7 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
40
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Results per page:
10
25
50
100
200