mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 02:11:19 -04:00
modify some details of EncodePrivateSyscap.
Signed-off-by: yudechen <chenyude@huawei.com> Change-Id: Ice0e16c5dac4242bd27fce7fc740eec232e90035
This commit is contained in:
@@ -111,28 +111,31 @@ bool EncodeOsSyscap(char output[128])
|
||||
bool EncodePrivateSyscap(char **output, int *outputLen)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t res;
|
||||
char *contextBuffer = NULL;
|
||||
char *outputStr = NULL;
|
||||
uint32_t bufferLen;
|
||||
|
||||
ret = GetFileContext(&contextBuffer, &bufferLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("GetFileContext failed, input file : rk3568.sc\n");
|
||||
PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
*outputLen = bufferLen - MAX_SYSCAP_STR_LEN - 1;
|
||||
*outputLen = bufferLen - PCID_MAIN_LEN - 1;
|
||||
outputStr = (char *)malloc(*outputLen);
|
||||
if (outputStr == NULL) {
|
||||
PRINT_ERR("malloc buffer failed, size = %d, errno = %d\n", *outputLen, errno);
|
||||
*outputLen = 0;
|
||||
return false;
|
||||
}
|
||||
(void)memset_s(outputStr, *outputLen, 0, *outputLen);
|
||||
res = strncpy_s(outputStr, *outputLen + 1, contextBuffer + MAX_SYSCAP_STR_LEN, *outputLen);
|
||||
if (res != 0) {
|
||||
|
||||
ret = strncpy_s(outputStr, *outputLen, contextBuffer + PCID_MAIN_LEN, *outputLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("strcpy_s failed.");
|
||||
FreeContextBuffer(contextBuffer);
|
||||
free(outputStr);
|
||||
*outputLen = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ int32_t CreatePCID(char *inputFile, char *outDirPath)
|
||||
allPriSyscapStrLen++; // for separator ','
|
||||
}
|
||||
if ((allPriSyscapStrLen + 1) > PRIVATE_SYSCAP_SIZE) {
|
||||
PRINT_ERR("context of \"pri\" array is too many\n");
|
||||
PRINT_ERR("context of \"pri\" array is too many.\n");
|
||||
ret = -1;
|
||||
goto FREE_CONVERT_OUT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user