Skip to content

Commit

Permalink
Make ctime call thread safe (#4216)
Browse files Browse the repository at this point in the history
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
  • Loading branch information
ssanadhya authored and tmdzk committed Jan 1, 2021
1 parent 43374a5 commit be117e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lte/gateway/c/oai/common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ static char* log_get_readable_cur_time(time_t* cur_time) {
// get the current local time
*cur_time = time(NULL);
// get the current local time in readable string format
return (strtok(ctime(cur_time), "\n"));
char buf[26];
return (strtok(ctime_r((const time_t*) cur_time, buf), "\n"));
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit be117e4

Please sign in to comment.