mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-30 22:01:06 +00:00
fix bug for trigger
Signed-off-by: cheng_jinsong <chengjinsong2@huawei.com>
This commit is contained in:
parent
333d6985d9
commit
fe79926f23
@ -328,8 +328,20 @@ 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");
|
||||
char *tmp = strstr(condition, input);
|
||||
if ((tmp != NULL) && ((int)strlen(tmp) > length) && (tmp[length] == '=')) {
|
||||
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;
|
||||
}
|
||||
return 0;
|
||||
|
@ -448,8 +448,7 @@ int32_t CheckAndMarkTrigger_(const TriggerWorkSpace *workSpace, int type, const
|
||||
trigger = head->nextTrigger(head, trigger);
|
||||
continue;
|
||||
}
|
||||
const char *tmp = strstr(head->getCondition(trigger), name);
|
||||
if (tmp != NULL && strncmp(tmp + strlen(name), "=", 1) == 0) {
|
||||
if (CheckMatchSubCondition(head->getCondition(trigger), name, strlen(name)) == 1) {
|
||||
TRIGGER_SET_FLAG(trigger, TRIGGER_FLAGS_RELATED);
|
||||
ret = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user