From: Nishant Chaprana Date: Wed, 20 May 2020 04:40:02 +0000 (+0530) Subject: Use thread safe localtime_r() instead of localtime() X-Git-Tag: submit/tizen/20200520.224506^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F233882%2F2;p=platform%2Fcore%2Fconnectivity%2Fstc-iptables.git Use thread safe localtime_r() instead of localtime() Change-Id: I21375288846a67bdb6db1d128ca2373a89269615 Signed-off-by: Nishant Chaprana --- diff --git a/packaging/stc-iptables.spec b/packaging/stc-iptables.spec index 031151a..75a1c4e 100644 --- a/packaging/stc-iptables.spec +++ b/packaging/stc-iptables.spec @@ -1,6 +1,6 @@ Name: stc-iptables Summary: STC(Smart Traffic Control) iptables -Version: 0.0.25 +Version: 0.0.26 Release: 0 Group: Network & Connectivity/Other License: GPL-2.0 and Apache-2.0 diff --git a/src/helper/helper-log.c b/src/helper/helper-log.c index 6f629bf..2dbc87b 100755 --- a/src/helper/helper-log.c +++ b/src/helper/helper-log.c @@ -75,14 +75,14 @@ static void __stc_iptables_log_make_backup(void) static void __stc_iptables_log_get_local_time(char *strtime, const int size) { - struct timeval tv; - struct tm *local_ptm; char buf[32]; + struct timeval tv; + struct tm result = {0, }; gettimeofday(&tv, NULL); - local_ptm = localtime(&tv.tv_sec); - strftime(buf, sizeof(buf), "%m/%d %H:%M:%S", local_ptm); + strftime(buf, sizeof(buf), "%m/%d %H:%M:%S", + localtime_r(&tv.tv_sec, &result)); snprintf(strtime, size, "%s.%03ld", buf, tv.tv_usec / 1000); }