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);
*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
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
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);