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)