Use re-entrant functions in a couple of places

Replace strtok and gmtime with their re-entrant versions. More to come.
This commit is contained in:
Evan Miller
2020-11-12 11:20:05 -05:00
parent 97e1d348f7
commit 1bef1b1dca
2 changed files with 6 additions and 4 deletions

View File

@@ -760,8 +760,9 @@ int mdb_sql_find_sargcol(MdbSargNode *node, gpointer data)
* Plain integers are UNIX timestamps for backwards compatibility of parser
*/
if (col->col_type == MDB_DATETIME && node->val_type == MDB_INT) {
struct tm *tm = gmtime((time_t*)&node->value.i);
mdb_tm_to_date(tm, &node->value.d);
struct tm tm;
gmtime_r((time_t*)&node->value.i, &tm);
mdb_tm_to_date(&tm, &node->value.d);
node->val_type = MDB_DOUBLE;
}
}