!224 fix:partition name is null, skip create symbol links

Merge pull request !224 from 熊磊/init0104_1
This commit is contained in:
openharmony_ci 2022-01-05 02:03:42 +00:00 committed by Gitee
commit feafe7ec3e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 2 deletions

View File

@ -166,7 +166,7 @@ int ServiceControlWithExtra(const char *serviceName, int action, const char *ext
int ServiceControl(const char *serviceName, int action)
{
if (serviceName == 0) {
if (serviceName == NULL) {
HILOG_ERROR(LOG_CORE, "Service getctl failed, service is null.\n");
return -1;
}

View File

@ -175,8 +175,16 @@ static char *FindPlatformDeviceName(char *path)
static void BuildBootDeviceSymbolLink(char **links, int linkNum, const char *partitionName)
{
if (links == NULL) {
INIT_LOGE("Function parameter error.");
return;
}
if (linkNum > BLOCKDEVICE_LINKS - 1) {
INIT_LOGW("Too many links, ignore");
INIT_LOGW("Too many links, ignore.");
return;
}
if (partitionName == NULL) {
INIT_LOGW("Partition name is null, skip creating links");
return;
}
links[linkNum] = calloc(sizeof(char), DEVICE_FILE_SIZE);