Module: kamailio Branch: master Commit: a6a4046757c2cac79455aa4a2d2ac632faa5e379 URL: https://github.com/kamailio/kamailio/commit/a6a4046757c2cac79455aa4a2d2ac632...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-05-06T17:13:16+02:00
htable: use localtime_r() for a safer multi-thread usage
---
Modified: src/modules/htable/htable.c
---
Diff: https://github.com/kamailio/kamailio/commit/a6a4046757c2cac79455aa4a2d2ac632... Patch: https://github.com/kamailio/kamailio/commit/a6a4046757c2cac79455aa4a2d2ac632...
---
diff --git a/src/modules/htable/htable.c b/src/modules/htable/htable.c index a1a8e04c48..55717ecd94 100644 --- a/src/modules/htable/htable.c +++ b/src/modules/htable/htable.c @@ -1322,7 +1322,7 @@ static void htable_rpc_get(rpc_t* rpc, void* c) { ht_cell_t *htc; /*!< One HT cell */ void* th; void* vh; - struct tm *_expire_t; + struct tm _expire_t; char expire_buf[RPC_DATE_BUF_LEN]="NEVER";
if (rpc->scan(c, "SS", &htname, &keyname) < 2) { @@ -1357,9 +1357,9 @@ static void htable_rpc_get(rpc_t* rpc, void* c) { }
if (htc->expire) { - _expire_t = localtime(&htc->expire); + localtime_r(&htc->expire, &_expire_t); strftime(expire_buf, RPC_DATE_BUF_LEN - 1, - "%Y-%m-%d %H:%M:%S", _expire_t); + "%Y-%m-%d %H:%M:%S", &_expire_t); }
if(htc->flags&AVP_VAL_STR) {