diff --git a/include/create_pcid.h b/include/create_pcid.h index 2f43282cd96c1b5714fbea0a66f919f44bd103ce..5baade6e49be2ca1448ad249e2f7d6794e0bd7ed 100644 --- a/include/create_pcid.h +++ b/include/create_pcid.h @@ -76,6 +76,7 @@ typedef enum SystemCapabilityNum { HIVIEWDFX_HIVIEW_FAULTLOGGER, I18N, GLOBAL_I18N, + KERNEL_LINUX, KERNEL_LITEOS_A, LOCATION_LOCATION, MISCSERVICES_DOWNLOAD, diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 32bc89780beb01b6db3d9439c1b9b748ace03f1b..4a0109d97de116a7051d418b2d384776d82316e0 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -96,6 +96,7 @@ static const SyscapWithNum arraySyscap[] = { {"SystemCapability.HiviewDFX.Hiview.FaultLogger", HIVIEWDFX_HIVIEW_FAULTLOGGER}, {"SystemCapability.I18N", I18N}, {"SystemCapability.Global.I18n", GLOBAL_I18N}, + {"SystemCapability.Kernel.Linux", KERNEL_LINUX}, {"SystemCapability.Kernel.liteos-a", KERNEL_LITEOS_A}, {"SystemCapability.Location.Location", LOCATION_LOCATION}, {"SystemCapability.MiscServices.download", MISCSERVICES_DOWNLOAD}, diff --git a/src/create_pcid.c b/src/create_pcid.c index e97d96a8cdf4c630a6533874e52cbc6781eb1b32..3153622cf096d9b4b2f4f609594e514f616dee8e 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -100,6 +100,7 @@ static SyscapWithNum arraySyscap[] = { {"SystemCapability.HiviewDFX.Hiview.FaultLogger", HIVIEWDFX_HIVIEW_FAULTLOGGER}, {"SystemCapability.I18N", I18N}, {"SystemCapability.Global.I18n", GLOBAL_I18N}, + {"SystemCapability.Kernel.Linux", KERNEL_LINUX}, {"SystemCapability.Kernel.liteos-a", KERNEL_LITEOS_A}, {"SystemCapability.Location.Location", LOCATION_LOCATION}, {"SystemCapability.MiscServices.download", MISCSERVICES_DOWNLOAD}, @@ -357,6 +358,11 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) for (i = 0; i < osCapSize; i++) { jsonArrayItem = cJSON_GetArrayItem(jsonOsSyscapObj, i); osCapIndex = cJSON_GetObjectItem(allOsSyscapObj, jsonArrayItem->valuestring); + if (osCapIndex == NULL) { + PRINT_ERR("can't find the syscap: %s, please checkout.\n", jsonArrayItem->valuestring); + ret = -1; + goto FREE_CONVERT_OUT; + } sectorOfBits = (osCapIndex->valueint) / BITS_OF_ONE_BYTE; posOfBits = (osCapIndex->valueint) % BITS_OF_ONE_BYTE; if (sectorOfBits >= BYTES_OF_OS_SYSCAP) {