mirror of
https://gitee.com/openharmony/deviceprofile_device_info_manager
synced 2024-11-23 07:30:13 +00:00
优化dlclose的使用
Signed-off-by: guoyi <guoyi39@huawei.com>
This commit is contained in:
parent
14550342e2
commit
5691b7f178
@ -431,7 +431,10 @@ bool DeviceProfileManager::LoadDpSyncAdapter()
|
|||||||
HILOGI("File %{public}s canonicalization failed", soName.c_str());
|
HILOGI("File %{public}s canonicalization failed", soName.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void *so_handle = dlopen(soName.c_str(), RTLD_NOW);
|
void *so_handle = dlopen(soName.c_str(), RTLD_NOW | RTLD_NOLOAD);
|
||||||
|
if (so_handle == nullptr) {
|
||||||
|
so_handle = dlopen(soName.c_str(), RTLD_NOW);
|
||||||
|
}
|
||||||
if (so_handle == nullptr) {
|
if (so_handle == nullptr) {
|
||||||
HILOGI("load dp sync adapter so %{public}s failed", soName.c_str());
|
HILOGI("load dp sync adapter so %{public}s failed", soName.c_str());
|
||||||
return false;
|
return false;
|
||||||
@ -453,7 +456,6 @@ bool DeviceProfileManager::LoadDpSyncAdapter()
|
|||||||
if (dpSyncAdapter_->Initialize() != DP_SUCCESS) {
|
if (dpSyncAdapter_->Initialize() != DP_SUCCESS) {
|
||||||
dpSyncAdapter_->Release();
|
dpSyncAdapter_->Release();
|
||||||
dpSyncAdapter_ = nullptr;
|
dpSyncAdapter_ = nullptr;
|
||||||
dlclose(so_handle);
|
|
||||||
isAdapterSoLoaded_ = false;
|
isAdapterSoLoaded_ = false;
|
||||||
HILOGI("dp sync adapter init failed");
|
HILOGI("dp sync adapter init failed");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user