ENDIF(NOT CMAKE_BUILD_TYPE)
# Compiler flags
-SET(EXTRA_FLAGS "-Wall -Wextra -Werror -Wnon-virtual-dtor")
+SET(EXTRA_FLAGS "-Wall -Wextra -Werror -Wnon-virtual-dtor -Wshadow")
SET(EXTRA_OPTIMIZATION_FLAGS "-Wl,--gc-sections -flto -fmerge-all-constants")
SET(CMAKE_C_FLAGS_PROFILING "-O2 ${EXTRA_FLAGS}")
plugin_info_.name().c_str(),
[](const char*, const char* appid, const char*,
const char*, void* user_data) -> int {
- auto* appid_list =
+ auto* list =
static_cast<std::vector<std::string>*>(user_data);
- appid_list->emplace_back(std::string(appid));
+ list->emplace_back(std::string(appid));
return PMINFO_R_OK;
},
&appid_list) != PMINFO_R_OK) {
ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(filter_handle,
[](const pkgmgrinfo_pkginfo_h handle, void* user_data) -> int {
- uid_t uid =
+ uid_t u =
static_cast<uid_t>(reinterpret_cast<uintptr_t>(user_data));
char* pkgid = nullptr;
- int ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
- if (ret != PMINFO_R_OK)
+ int r = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+ if (r != PMINFO_R_OK)
return -1;
- if (!PerformExternalDirectoryCreationForUser(uid, pkgid))
+ if (!PerformExternalDirectoryCreationForUser(u, pkgid))
return -1;
return 0;
return false;
}
- std::string error_message;
if (!ci::RegisterSecurityContextForPath(pkgid, apps_rw / pkgid, uid,
false, &error_message)) {
LOG(ERROR) << "Failed to register security context for path: "
return false;
}
} else if (bf::is_symlink(symlink_status(iter->path()))) {
- bs::error_code error;
bf::copy_symlink(iter->path(), to / iter->path().filename(), error);
if (error) {
LOG(ERROR) << "Failed to backup package symlink: " << iter->path();
if (bf::is_directory(path) && path.filename() == "bin") {
if (!GrantPermission755(path))
return false;
- for (auto& entry :
+ for (auto& bin_entry :
boost::make_iterator_range(bf::directory_iterator(path), {})) {
- auto path = entry.path();
- if (bf::is_symlink(symlink_status(path)))
+ auto bin_path = bin_entry.path();
+ if (bf::is_symlink(symlink_status(bin_path)))
continue;
- if (bf::is_regular_file(path)) {
- if (!GrantPermission755(path))
+ if (bf::is_regular_file(bin_path)) {
+ if (!GrantPermission755(bin_path))
return false;
}
}
if (bf::is_directory(path) && path.filename() == "lib") {
if (!GrantPermission755(path))
return false;
- for (auto& entry :
+ for (auto& lib_entry :
boost::make_iterator_range(bf::directory_iterator(path), {})) {
- auto path = entry.path();
- if (bf::is_symlink(symlink_status(path)))
+ auto lib_path = lib_entry.path();
+ if (bf::is_symlink(symlink_status(lib_path)))
continue;
- if (bf::is_regular_file(path)) {
- if (!GrantPermission644(path))
+ if (bf::is_regular_file(lib_path)) {
+ if (!GrantPermission644(lib_path))
return false;
}
}
<< " to: " << install_path << " directory";
if (context_->storage.get() == Storage::EXTENDED) {
- bs::error_code error;
bf::create_symlink(install_path, context_->GetPkgPath(), error);
if (error) {
LOG(ERROR) << "Failed to create symlink for extended path: "
return false;
}
} else {
- bs::error_code error;
bf::copy(iter->path(), to / iter->path().filename(), error);
if (error) {
LOG(ERROR) << "Failed to create copy of: " << iter->path();
ci::UserList list = ci::GetUserList();
for (auto l : list) {
- uid_t uid = std::get<0>(l);
- gid_t gid = std::get<1>(l);
- bf::path apps_rw = ci::GetRootAppPath(false, uid);
+ uid_t lu = std::get<0>(l);
+ gid_t lg = std::get<1>(l);
+ bf::path apps_rw = ci::GetRootAppPath(false, lu);
bf::path pkg_root = apps_rw / context_->pkgid.get();
- if (!ci::SetPackageDirectoryOwnerAndPermissions(pkg_root, uid))
+ if (!ci::SetPackageDirectoryOwnerAndPermissions(pkg_root, lu))
return Step::Status::ERROR;
if (!SetSharedDirOwnershipAndPermissions(apps_rw, context_->pkgid.get(),
- uid, gid))
+ lu, lg))
return Step::Status::ERROR;
}
} else {
} // namespace filesystem
} // namespace common_installer
-
}
if (level == PrivilegeLevel::UNTRUSTED) {
- std::string error_message =
- "Unsigned applications can not be installed";
+ error_message = "Unsigned applications can not be installed";
on_error(Status::SIGNATURE_ERROR, error_message);
return Status::SIGNATURE_ERROR;
}
return true;
if (state != STORAGE_STATE_MOUNTED)
return true;
- bool* is_available = static_cast<bool*>(user_data);
+ bool* available = static_cast<bool*>(user_data);
if (bf::exists(path))
- *is_available = true;
+ *available = true;
// Stop iteration
return false;
},
UNUSED(user_data);
GError* err = nullptr;
GDBusInterfaceVTable vtable = {
- [](GDBusConnection* connection, const gchar* sender,
+ [](GDBusConnection* conn, const gchar* sender,
const gchar* object_path, const gchar* interface_name,
const gchar* method_name, GVariant* parameters,
- GDBusMethodInvocation* invocation, gpointer user_data) {
- reinterpret_cast<PkgdirToolService*>(user_data)->HandleMethodCall(
- connection, sender, object_path, interface_name, method_name,
- parameters, invocation, user_data);
+ GDBusMethodInvocation* invocation, gpointer data) {
+ reinterpret_cast<PkgdirToolService*>(data)->HandleMethodCall(
+ conn, sender, object_path, interface_name, method_name,
+ parameters, invocation, data);
},
nullptr, nullptr, {0, }
};