2
0
Эх сурвалжийг харах

drouting: use localtime_r() for a safer multi-thread usage

Victor Seva 5 жил өмнө
parent
commit
1fe9da8c11

+ 3 - 1
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)