未验证 提交 feafe7ec 编写于 作者: O openharmony_ci 提交者: Gitee

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

Merge pull request !224 from 熊磊/init0104_1
...@@ -166,7 +166,7 @@ int ServiceControlWithExtra(const char *serviceName, int action, const char *ext ...@@ -166,7 +166,7 @@ int ServiceControlWithExtra(const char *serviceName, int action, const char *ext
int ServiceControl(const char *serviceName, int action) int ServiceControl(const char *serviceName, int action)
{ {
if (serviceName == 0) { if (serviceName == NULL) {
HILOG_ERROR(LOG_CORE, "Service getctl failed, service is null.\n"); HILOG_ERROR(LOG_CORE, "Service getctl failed, service is null.\n");
return -1; return -1;
} }
......
...@@ -175,8 +175,16 @@ static char *FindPlatformDeviceName(char *path) ...@@ -175,8 +175,16 @@ static char *FindPlatformDeviceName(char *path)
static void BuildBootDeviceSymbolLink(char **links, int linkNum, const char *partitionName) static void BuildBootDeviceSymbolLink(char **links, int linkNum, const char *partitionName)
{ {
if (links == NULL) {
INIT_LOGE("Function parameter error.");
return;
}
if (linkNum > BLOCKDEVICE_LINKS - 1) { 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; return;
} }
links[linkNum] = calloc(sizeof(char), DEVICE_FILE_SIZE); links[linkNum] = calloc(sizeof(char), DEVICE_FILE_SIZE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册