提交 762df415 编写于 作者: Y yudechen

修改HasSystemCapability拼接param名错误。

Change-Id: Ic147a9b0d15ceb0e3a33146c2c429924c96e54bc
Signed-off-by: Nyudechen <chenyude@huawei.com>
上级 93bec381
......@@ -25,6 +25,7 @@
#define SYSCAP_MAX_SIZE 100
#define SYSCAP_PREFIX_NAME "SystemCapability"
#define CONST_SYSCAP_PREFIX_NAME "const.SystemCapability"
bool HasSystemCapability(const char *cap)
{
......@@ -32,12 +33,12 @@ bool HasSystemCapability(const char *cap)
char paramValue[PARAM_VALUE_LEN_MAX] = { 0 };
unsigned int valueLen = PARAM_VALUE_LEN_MAX;
if (strncmp(SYSCAP_PREFIX_NAME, cap, sizeof(SYSCAP_PREFIX_NAME) - 1) != 0) {
if (strncpy_s(capName, sizeof(capName), cap, sizeof(capName) - 1) < 0) {
BEGET_LOGE("Failed strncpy_s err=%d", errno);
if (strncmp(SYSCAP_PREFIX_NAME, cap, sizeof(SYSCAP_PREFIX_NAME) - 1) == 0) {
if (snprintf_s(capName, SYSCAP_MAX_SIZE, SYSCAP_MAX_SIZE - 1, "const.%s", cap) == -1) {
BEGET_LOGE("Failed snprintf_s err=%d", errno);
return false;
}
} else if (snprintf_s(capName, SYSCAP_MAX_SIZE, SYSCAP_MAX_SIZE - 1, SYSCAP_PREFIX_NAME".%s", cap) == -1) {
} else if (snprintf_s(capName, SYSCAP_MAX_SIZE, SYSCAP_MAX_SIZE - 1, CONST_SYSCAP_PREFIX_NAME".%s", cap) == -1) {
BEGET_LOGE("Failed snprintf_s err=%d", errno);
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册