共 4 个文件变更+11-7
@@ -753,7 +753,7 @@ bool BundleMgrAdapter::GetUidGidForBundleName(const std::string &bundleName, int
753 return false;753 return false;
754 }754 }
755 uid = bundleInfo.uid;755 uid = bundleInfo.uid;
756- gid = bundleInfo.gid;756+ gid = static_cast<gid_t>(bundleInfo.gid);
757 HILOGI("End GetUidGidForBundleName, bundleName:%{public}s, uid:%{public}d, gid:%{public}d",757 HILOGI("End GetUidGidForBundleName, bundleName:%{public}s, uid:%{public}d, gid:%{public}d",
758 bundleName.c_str(), uid, gid);758 bundleName.c_str(), uid, gid);
759 return true;759 return true;
@@ -1970,8 +1970,8 @@ ErrCode Service::DoEnhanceMove(const std::string &srcFile, const std::string &de
1970 FileBackupParam param = {};1970 FileBackupParam param = {};
1971 if (strncpy_s(param.srcFilePath, sizeof(param.srcFilePath), srcFile.c_str(), srcFile.length()) != EOK ||1971 if (strncpy_s(param.srcFilePath, sizeof(param.srcFilePath), srcFile.c_str(), srcFile.length()) != EOK ||
1972 strncpy_s(param.dstFilePath, sizeof(param.dstFilePath), destFile.c_str(), destFile.length()) != EOK ||1972 strncpy_s(param.dstFilePath, sizeof(param.dstFilePath), destFile.c_str(), destFile.length()) != EOK ||
1973- snprintf_s(param.uid, sizeof(param.uid), sizeof(param.uid) - 1, "%d", uid) < 0 ||1973+ snprintf_s(param.uid, sizeof(param.uid), sizeof(param.uid) - 1, "%u", uid) < 0 ||
1974- snprintf_s(param.gid, sizeof(param.gid), sizeof(param.gid) - 1, "%d", gid) < 0) {1974+ snprintf_s(param.gid, sizeof(param.gid), sizeof(param.gid) - 1, "%u", gid) < 0) {
1975 HILOGE("Dassemble param error");1975 HILOGE("Dassemble param error");
1976 return BError(BError::Codes::SA_INVAL_ARG, "assemble param error").GetCode();1976 return BError(BError::Codes::SA_INVAL_ARG, "assemble param error").GetCode();
1977 }1977 }
@@ -2120,8 +2120,8 @@ ErrCode Service::DoEnhanceOpen(const std::string &filePath, uid_t uid, gid_t gid
2120 2120 
2121 FileBackupParam param = {};2121 FileBackupParam param = {};
2122 if (strncpy_s(param.srcFilePath, sizeof(param.srcFilePath), filePath.c_str(), filePath.length()) != EOK ||2122 if (strncpy_s(param.srcFilePath, sizeof(param.srcFilePath), filePath.c_str(), filePath.length()) != EOK ||
2123- snprintf_s(param.uid, sizeof(param.uid), sizeof(param.uid) - 1, "%d", uid) < 0 ||2123+ snprintf_s(param.uid, sizeof(param.uid), sizeof(param.uid) - 1, "%u", uid) < 0 ||
2124- snprintf_s(param.gid, sizeof(param.gid), sizeof(param.gid) - 1, "%d", gid) < 0) {2124+ snprintf_s(param.gid, sizeof(param.gid), sizeof(param.gid) - 1, "%u", gid) < 0) {
2125 HILOGE("assemble param error");2125 HILOGE("assemble param error");
2126 return BError(BError::Codes::SA_INVAL_ARG, "assemble param error").GetCode();2126 return BError(BError::Codes::SA_INVAL_ARG, "assemble param error").GetCode();
2127 }2127 }
@@ -85,10 +85,10 @@ void SvcBackupConnection::GenErrorByStatus(int errCode, bool hasConnected)
85 error_ = BError(errCode, BError::Codes::EXT_ABILITY_DIED, errMsg);85 error_ = BError(errCode, BError::Codes::EXT_ABILITY_DIED, errMsg);
86 } else {86 } else {
87 connectSpend_.End();87 connectSpend_.End();
88- uint32_t failSpend = connectSpend_.GetSpan();88+ uint64_t failSpend = connectSpend_.GetSpan();
89 string errMsg = "{\"failSpend\": " + to_string(failSpend) + ",\"isCleanCalled\":"89 string errMsg = "{\"failSpend\": " + to_string(failSpend) + ",\"isCleanCalled\":"
90 + to_string(isCleanCalled_) + "}";90 + to_string(isCleanCalled_) + "}";
91- if (failSpend >= TimeUtils::GetAmsTimeout() * SECOND_TO_MS) {91+ if (failSpend >= static_cast<uint64_t>(TimeUtils::GetAmsTimeout() * SECOND_TO_MS)) {
92 error_ = BError(errCode, BError::Codes::SA_BOOT_EXT_TIMEOUT, errMsg);92 error_ = BError(errCode, BError::Codes::SA_BOOT_EXT_TIMEOUT, errMsg);
93 } else {93 } else {
94 error_ = BError(errCode, BError::Codes::EXT_ABILITY_DIED, errMsg);94 error_ = BError(errCode, BError::Codes::EXT_ABILITY_DIED, errMsg);
@@ -273,6 +273,10 @@ ErrCode MigrateManager::DealIncrementalDone(ErrCode errCode)
273{273{
274 HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);274 HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__);
275 try {275 try {
276+ if (servicePtr_ == nullptr) {
277+ HILOGE("servicePtr_ is null");
278+ return BError(BError::Codes::EXT_BROKEN_IPC).GetCode();
279+ }
276 if (servicePtr_->session_ == nullptr) {280 if (servicePtr_->session_ == nullptr) {
277 HILOGE("AppIncrementalDone error, session is null");281 HILOGE("AppIncrementalDone error, session is null");
278 return BError(BError::Codes::SA_INVAL_ARG);282 return BError(BError::Codes::SA_INVAL_ARG);