From 8e1634ca4c1b88485c6d8d8175fef398a154b4a7 Mon Sep 17 00:00:00 2001 From: cheng_jinsong Date: Wed, 21 Dec 2022 00:18:54 -0800 Subject: [PATCH] fixed 595b97c from https://gitee.com/linrj2022/startup_init_lite/pulls/1642 fix trigger check bug Signed-off-by: cheng_jinsong Change-Id: Ifb63f20d38cd6e74ca96a18e5e6f498339e3ea6c --- services/param/trigger/trigger_checker.c | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/services/param/trigger/trigger_checker.c b/services/param/trigger/trigger_checker.c index 972ce925..4b95fbb2 100644 --- a/services/param/trigger/trigger_checker.c +++ b/services/param/trigger/trigger_checker.c @@ -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 -- GitLab