Fix #16
This commit is contained in:
parent
06a33303c3
commit
05cafca292
|
|
@ -58,4 +58,15 @@ namespace lspd {
|
|||
stat(path.c_str(), &sb);
|
||||
return {sb.st_uid, sb.st_gid};
|
||||
}
|
||||
|
||||
inline void recursive_permissions(const std::filesystem::path &p,
|
||||
std::filesystem::perms prms,
|
||||
std::filesystem::perm_options opts = std::filesystem::perm_options::replace) {
|
||||
std::filesystem::permissions(p, prms, opts);
|
||||
if (std::filesystem::is_directory(p)) {
|
||||
for(auto &item : std::filesystem::recursive_directory_iterator(p)) {
|
||||
std::filesystem::permissions(item.path(), prms, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,15 +271,15 @@ namespace lspd {
|
|||
if (!path_exists<true>(log_path)) {
|
||||
fs::create_directories(log_path);
|
||||
}
|
||||
fs::permissions(conf_path, fs::perms::owner_all | fs::perms::group_all | fs::perms::set_gid);
|
||||
fs::permissions(log_path, fs::perms::owner_all | fs::perms::group_all | fs::perms::set_gid);
|
||||
recursive_permissions(conf_path, fs::perms::owner_all | fs::perms::group_all | fs::perms::set_gid);
|
||||
recursive_permissions(log_path, fs::perms::owner_all | fs::perms::group_all | fs::perms::set_gid);
|
||||
if (pkg_name == "android") uid = -1;
|
||||
path_chown(conf_path, uid, 1000u, true);
|
||||
path_chown(log_path, uid, 1000u, true);
|
||||
if (current_user_ == 0) {
|
||||
auto variant = GetMiscPath() / "variant";
|
||||
fs::permissions(variant, fs::perms::owner_all | fs::perms::group_all);
|
||||
chown(variant.c_str(), uid, 1000u);
|
||||
path_chown(variant, uid, 1000u);
|
||||
}
|
||||
|
||||
if (pkg_name == kPrimaryInstallerPkgName) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue