Fix svace issue 51/89951/1 accepted/tizen/common/20160928.164502 submit/tizen/20160928.123210
authorstom.hwang <stom.hwang@samsung.com>
Wed, 28 Sep 2016 01:11:25 +0000 (10:11 +0900)
committerstom.hwang <stom.hwang@samsung.com>
Wed, 28 Sep 2016 01:11:25 +0000 (10:11 +0900)
Change-Id: I2ffefe51b038297695eb547e4e70a9e4e1a79b7b
Signed-off-by: stom.hwang <stom.hwang@samsung.com>
common/vc_cmd_db.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0168129..240928a
@@ -1249,12 +1249,13 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm
                temp_close[0] = '\0';
 
                // extract fixed command and remove space in front of  '{'
-               temp = strtok(src_cmd, "{");
+               char *tok_ptr = NULL;
+               temp = strtok_r(src_cmd, "{", &tok_ptr);
                __vc_db_remove_space(&temp);
                *fixed_cmd = strdup(temp);
 
                // merge command with fixed and vfixed
-               while (NULL != (temp = strtok(NULL, "|"))) {
+               while (NULL != (temp = strtok_r(NULL, "|", &tok_ptr))) {
                        __vc_db_remove_space(&temp);
 
                        snprintf(merge_cmd, 256, "%s %s", *fixed_cmd, temp);
@@ -1277,12 +1278,14 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm
                *fixed_cmd = strdup(temp_fixed);
 
                // remove close brace, '}'
-               temp = strtok(src_cmd, "}");
+               char *tok_ptr = NULL;
+               temp = strtok_r(src_cmd, "}", &tok_ptr);
 
                // remove open brace, '{'
                temp = strchr(src_cmd, '{') + 1;
 
-               temp = strtok(temp, "|");
+               tok_ptr = NULL;
+               temp = strtok_r(temp, "|", &tok_ptr);
                __vc_db_remove_space(&temp);
 
                // merge command with fixed and vfixed
@@ -1291,7 +1294,7 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm
                temp_list = g_slist_append(temp_list, dst_cmd);
                SLOG(LOG_ERROR, vc_db_tag(), "New generated cmd: %s", dst_cmd);
 
-               while (NULL != (temp = strtok(NULL, "|"))) {
+               while (NULL != (temp = strtok_r(NULL, "|", &tok_ptr))) {
                        __vc_db_remove_space(&temp);
 
                        // merge command with fixed and vfixed
@@ -1299,7 +1302,7 @@ static int __vc_db_generate_command(vc_cmd_s* cmd, char** fixed_cmd, GSList** cm
                        dst_cmd = strdup(merge_cmd);
                        temp_list = g_slist_append(temp_list, dst_cmd);
                        SLOG(LOG_ERROR, vc_db_tag(), "New generated cmd: %s", dst_cmd);
-                       }
+               }
        } else if (VC_CMD_FORMAT_FIXED_AND_NONFIXED == cmd->format || VC_CMD_FORMAT_NONFIXED_AND_FIXED == cmd->format) {
                dst_cmd = strdup(src_cmd);
                temp_list = g_slist_append(temp_list, dst_cmd);