提交 b51267cd 编写于 作者: M Mupceet

fix:xts bug

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 16ce3011
......@@ -33,7 +33,7 @@ static const char *g_emptyStr = "";
int IsValidValue(const char *value, unsigned int len)
{
if ((value == NULL) || !strlen(value) || (strlen(value) + 1 > len)) {
if ((value == NULL) || (strlen(value) + 1 > len)) {
return 0;
}
return 1;
......
......@@ -66,16 +66,12 @@ std::string GetParameter(const std::string& key, const std::string& def)
{
uint32_t size = 0;
int ret = SystemReadParam(key.c_str(), NULL, &size);
if (ret != 0) {
if (IsValidValue(def.c_str(), MAX_VALUE_LEN) == 1) {
return std::string(def);
}
return "";
}
std::vector<char> value(size + 1);
ret = SystemReadParam(key.c_str(), value.data(), &size);
if (ret == 0) {
return std::string(value.data());
std::vector<char> value(size + 1);
ret = SystemReadParam(key.c_str(), value.data(), &size);
if (ret == 0) {
return std::string(value.data());
}
}
if (IsValidValue(def.c_str(), MAX_VALUE_LEN) == 1) {
return std::string(def);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册