提交 8e1634ca 编写于 作者: C cheng_jinsong 提交者: linrj

fixed 595b97c7 from https://gitee.com/linrj2022/startup_init_lite/pulls/1642

fix trigger check bug
Signed-off-by: Ncheng_jinsong <chengjinsong2@huawei.com>
Change-Id: Ifb63f20d38cd6e74ca96a18e5e6f498339e3ea6c
上级 1c8f3ad6
......@@ -329,20 +329,21 @@ int CheckMatchSubCondition(const char *condition, const char *input, int length)
PARAM_CHECK(condition != NULL, return 0, "Invalid condition");
PARAM_CHECK(input != NULL, return 0, "Invalid input");
const char *tmp = strstr(condition, input);
if (tmp == NULL) {
return 0;
}
PARAM_LOGV("CheckMatchSubCondition Condition: '%s' content: '%s' length %d", condition, input, length);
if (((int)strlen(tmp) <= length) || (tmp[length] != '=')) {
return 0;
}
// for condition: parameter = 1
if (tmp == condition) {
return 1;
}
// for condition: parameter1 = 1 && parameter2 = 1
if (*(tmp - 1) == ' ') {
return 1;
while (tmp != NULL)
{
PARAM_LOGV("CheckMatchSubCondition Condition: '%s' content: '%s' length %d", condition, input, length);
if (((int)strlen(tmp) <= length) || (tmp[length] != '=')) {
return 0;
}
// for condition: parameter = 1
if (tmp == condition) {
return 1;
}
// for condition: parameter1 = 1 && parameter2 = 1
if (*(tmp - 1) == ' ') {
return 1;
}
tmp = strstr(tmp + 1, input);
}
return 0;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册