Fix Svace issue 87/61387/1
authorInHong Han <inhong1.han@samsung.com>
Mon, 7 Mar 2016 11:51:18 +0000 (20:51 +0900)
committerInHong Han <inhong1.han@samsung.com>
Mon, 7 Mar 2016 11:51:18 +0000 (20:51 +0900)
Change-Id: Ided4e6fbfea0c8caf941a1a1a5fc05b1e05d79b3

res/simple_debug.cpp
scl/sclcontroller.cpp

index d3c9fcc..2de8f76 100644 (file)
@@ -83,10 +83,13 @@ SclLog::log(enum LOG_LEVEL level, char* fmt, ...) {
     struct tm *timenow;
 
     time(&now);
-    timenow = localtime(&now);
+    localtime_r(&now, timenow);
 
     if (timenow) {
-        fprintf(m_flog, "[ %s ] %s\n", log_message[level], asctime(timenow));
+        char buf[64] = { 0 };
+        asctime_r(timenow, buf);
+
+        fprintf(m_flog, "[ %s ] %s\n", log_message[level], buf);
         fprintf(m_flog, "\t%s\n", str_log);
 
         fflush(m_flog);
index b75771f..219dcdc 100644 (file)
@@ -3515,7 +3515,9 @@ CSCLController::timer_event(const scl32 data)
     break;
     case SCL_TIMER_AUTOTEST: {
         srand(time(NULL));
-        sclint rnd = rand() % 100;
+
+        unsigned int seed;
+        sclint rnd = rand_r(&seed) % 100;
 
         const SclLayout *layout = cache->get_cur_layout(windows->get_base_window());
 
@@ -3523,10 +3525,10 @@ CSCLController::timer_event(const scl32 data)
             return FALSE;
         }
         srand(time(NULL));
-        sclint x = (rand() % (layout->width));
+        sclint x = (rand_r(&seed) % (layout->width));
 
         srand(time(NULL));
-        sclint y = (rand() % (layout->height));
+        sclint y = (rand_r(&seed) % (layout->height));
 
         if (rnd < 80) {
             events->generate_mouse_event(SCL_MOUSE_EVENT_PRESS, x, y);