From: Pawel Andruszkiewicz
Date: Tue, 8 Mar 2016 09:33:15 +0000 (+0100)
Subject: [KeyManager] Function strtok replaced with strtok_r.
X-Git-Tag: submit/tizen/20160308.223939^2~2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b915b9ccfa94a104ae5f03ecb6fa3115a66c6877;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[KeyManager] Function strtok replaced with strtok_r.
Fixes: SVACE 40857
[Verification] Code compiles, not tested, test does not start.
Change-Id: Ie6af0e302af2a3240733a5091462569074dc4755
Signed-off-by: Pawel Andruszkiewicz
---
diff --git a/src/keymanager/keymanager_instance.cc b/src/keymanager/keymanager_instance.cc
index 1a401e0d..3a5439ec 100644
--- a/src/keymanager/keymanager_instance.cc
+++ b/src/keymanager/keymanager_instance.cc
@@ -42,6 +42,8 @@ typedef std::vector RawBuffer;
typedef int (*AliasListFunction)(ckmc_alias_list_s**);
+const std::string kSpace = " ";
+
void GetGenericAliasList(AliasListFunction func, picojson::object* out) {
LoggerD("Enter");
@@ -60,9 +62,10 @@ void GetGenericAliasList(AliasListFunction func, picojson::object* out) {
while (head) {
//aliases.push_back(picojson::value(head->alias ? head->alias : ""));
if(head->alias) {
- char* tokenized = strtok(head->alias," ");
+ char* saveptr = nullptr;
+ char* tokenized = strtok_r(head->alias, kSpace.c_str(), &saveptr);
obj["packageId"] = picojson::value(tokenized);
- tokenized = strtok(NULL," ");
+ tokenized = strtok_r(nullptr, kSpace.c_str(), &saveptr);
obj["name"] = picojson::value(tokenized);
aliases.push_back(resultElem);