mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 16:20:00 +00:00
Description:Code optimization
Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: lwx1281857 <linnanmu@h-partners.com>
This commit is contained in:
parent
69fa48cd85
commit
e736225ecf
@ -78,6 +78,7 @@ static int AddBootEventItem(BOOT_EVENT_PARAM_ITEM *item, const char *paramName)
|
||||
}
|
||||
item->paramName = strdup(paramName);
|
||||
if (item->paramName == NULL) {
|
||||
free(item);
|
||||
return -1;
|
||||
}
|
||||
item->flags = BOOTEVENT_TYPE_SERVICE;
|
||||
|
@ -92,7 +92,7 @@ static int ParamFileStat(const char* path, unsigned int* fileSize)
|
||||
}
|
||||
*fileSize = lseek(fd, 0, SEEK_END);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
free(fd);
|
||||
close(fd);
|
||||
return 0;
|
||||
#else
|
||||
return UtilsFileStat(path, fileSize);
|
||||
|
@ -45,10 +45,12 @@ int main(int argc, char* argv[])
|
||||
INIT_ERROR_CHECK(ret >= 0, return -1, "Failed to format addr");
|
||||
if (connect(sockFd, (struct sockaddr *)&addr, sizeof(addr))) {
|
||||
INIT_LOGE("Failed to connect socket: %d", errno);
|
||||
close(sockFd);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
INIT_LOGE("input error, invalid server name");
|
||||
close(sockFd);
|
||||
return -1;
|
||||
}
|
||||
ret = write(sockFd, argv[ARG_COUNT], strlen(argv[ARG_COUNT]));
|
||||
|
@ -128,6 +128,7 @@ HWTEST_F(DeviceInfoUnittest, Init_DeviceInfoServiceInvalidTokenTest_001, TestSiz
|
||||
data.WriteInterfaceToken(OHOS::device_info::DeviceInfoStub::GetDescriptor());
|
||||
deviceInfoService->OnRemoteRequest
|
||||
(static_cast<uint32_t> (OHOS::device_info::DeviceInfoInterfaceCode::COMMAND_GET_UDID), data, reply, option);
|
||||
delete deviceInfoService;
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceInfoUnittest, Init_DeviceInfoServiceFailTest_001, TestSize.Level1)
|
||||
@ -151,6 +152,7 @@ HWTEST_F(DeviceInfoUnittest, Init_DeviceInfoServiceFailTest_001, TestSize.Level1
|
||||
deviceInfoService->OnRemoteRequest
|
||||
(static_cast<uint32_t> (OHOS::device_info::DeviceInfoInterfaceCode::COMMAND_GET_SERIAL_ID),
|
||||
data, reply, option);
|
||||
delete deviceInfoService;
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceInfoUnittest, Init_DeviceInfoServiceTest_001, TestSize.Level1)
|
||||
@ -186,6 +188,7 @@ HWTEST_F(DeviceInfoUnittest, Init_DeviceInfoServiceTest_001, TestSize.Level1)
|
||||
std::vector<std::u16string> args = {};
|
||||
deviceInfoService->Dump(STDOUT_FILENO, args);
|
||||
deviceInfoService->Dump(-1, args);
|
||||
delete deviceInfoService;
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceInfoUnittest, Init_TestInterface_001, TestSize.Level1)
|
||||
|
Loading…
Reference in New Issue
Block a user