Module: kamailio Branch: master Commit: c01633dc54d8d4dc3b3bc2cab064f91a49c8257d URL: https://github.com/kamailio/kamailio/commit/c01633dc54d8d4dc3b3bc2cab064f91a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-05-04T18:26:47+02:00
libs/srdb1: use thread safe localtime_r()
---
Modified: src/lib/srdb1/db_ut.c
---
Diff: https://github.com/kamailio/kamailio/commit/c01633dc54d8d4dc3b3bc2cab064f91a... Patch: https://github.com/kamailio/kamailio/commit/c01633dc54d8d4dc3b3bc2cab064f91a...
---
diff --git a/src/lib/srdb1/db_ut.c b/src/lib/srdb1/db_ut.c index 39ac11d379..318b442e44 100644 --- a/src/lib/srdb1/db_ut.c +++ b/src/lib/srdb1/db_ut.c @@ -350,7 +350,7 @@ int db_str2time(const char* _s, time_t* _v) */ int db_time2str_ex(time_t _v, char* _s, int* _l, int _qmode) { - struct tm* t; + struct tm t; int l;
if ((!_s) || (!_l) || (*_l < 2)) { @@ -361,8 +361,8 @@ int db_time2str_ex(time_t _v, char* _s, int* _l, int _qmode) if(_qmode) *_s++ = ''';
/* Convert time_t structure to format accepted by the database */ - t = localtime(&_v); - l = strftime(_s, *_l -1, "%Y-%m-%d %H:%M:%S", t); + localtime_r(&_v, &t); + l = strftime(_s, *_l -1, "%Y-%m-%d %H:%M:%S", &t);
if (l == 0) { LM_ERR("Error during time conversion\n");