From 8d55cd67bf1563411db9fa73d0f4271ced55535e Mon Sep 17 00:00:00 2001 From: chengjinsong Date: Tue, 1 Nov 2022 19:42:29 +0800 Subject: [PATCH] fixed 0b830a0 from https://gitee.com/chneg-jinsong/startup_init_lite/pulls/1461 codex Signed-off-by: chengjinsong --- services/init/init_service_manager.c | 2 +- services/modules/reboot/reboot_static.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/init/init_service_manager.c b/services/init/init_service_manager.c index b667de75..26c14991 100755 --- a/services/init/init_service_manager.c +++ b/services/init/init_service_manager.c @@ -1006,7 +1006,7 @@ void ParseAllServices(const cJSON *fileRoot) if (service == NULL) { INIT_LOGE("Failed to add service name %s", fieldStr); continue; - } + } } else { INIT_LOGI("Service %s already exists, updating.", fieldStr); #ifndef __MUSL__ diff --git a/services/modules/reboot/reboot_static.c b/services/modules/reboot/reboot_static.c index 70ddb34d..97d41b97 100644 --- a/services/modules/reboot/reboot_static.c +++ b/services/modules/reboot/reboot_static.c @@ -128,7 +128,8 @@ static int AddRebootCmdExecutor_(const char *cmd, CmdExecutor executor) } g_rebootParamCmdInfos = cmdInfos; } - PLUGIN_CHECK(g_rebootParamCmdValidNumber < g_rebootParamCmdMaxNumber, return -1, "Param cmd number exceed limit"); + PLUGIN_CHECK(g_rebootParamCmdValidNumber >= 0 && g_rebootParamCmdValidNumber < g_rebootParamCmdMaxNumber, + return -1, "Param cmd number exceed limit"); return SetParamCmdInfo(&g_rebootParamCmdInfos[g_rebootParamCmdValidNumber], executor, cmd); } -- GitLab