From 309b951f7ddbcb41f71f6ccdec575bb050cb2d6d Mon Sep 17 00:00:00 2001 From: xionglei6 Date: Tue, 8 Mar 2022 14:25:10 +0800 Subject: [PATCH] fix: ondemand value parse Signed-off-by: xionglei6 --- services/init/init_service_manager.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/init/init_service_manager.c b/services/init/init_service_manager.c index ab955cd9..358e4cfb 100755 --- a/services/init/init_service_manager.c +++ b/services/init/init_service_manager.c @@ -604,8 +604,7 @@ static int GetDynamicService(const cJSON *curArrItem, Service *curServ) INIT_ERROR_CHECK(cJSON_IsBool(item), return SERVICE_FAILURE, "Service : %s dynamic value only support bool.", curServ->name); - bool isDynamic = (bool)cJSON_GetNumberValue(item); - INIT_INFO_CHECK(isDynamic, return SERVICE_SUCCESS, + INIT_INFO_CHECK(cJSON_IsTrue(item), return SERVICE_SUCCESS, "Service : %s dynamic value is false, it will be started with init.", curServ->name); INIT_CHECK_RETURN_VALUE(!IsServiceInMainStrap(curServ), SERVICE_SUCCESS); INIT_LOGI("%s is dynamic service", curServ->name); @@ -624,8 +623,7 @@ static int GetServiceOnDemand(const cJSON *curArrItem, Service *curServ) INIT_ERROR_CHECK(cJSON_IsBool(item), return SERVICE_FAILURE, "Service : %s ondemand value only support bool.", curServ->name); - bool isOnDemand = (bool)cJSON_GetNumberValue(item); - INIT_INFO_CHECK(isOnDemand, return SERVICE_SUCCESS, + INIT_INFO_CHECK(cJSON_IsTrue(item), return SERVICE_SUCCESS, "Service : %s ondemand value is false, it will be manage socket by itself", curServ->name); if (curServ->attribute & SERVICE_ATTR_CRITICAL) { INIT_LOGE("Service : %s is invalid which has both critical and ondemand attribute", curServ->name); -- GitLab