[Service]
ExecStartPre=-/usr/bin/mkdir -p /run/aul/daemons/%U
ExecStartPre=-/usr/bin/chmod 0777 /run/aul/daemons/%U
-ExecStartPre=-/usr/bin/mkdir -p /run/aul/apps/%U
-ExecStartPre=-/usr/bin/chmod 0700 /run/aul/apps/%U
ExecStartPre=-/usr/bin/mkdir -p /run/aul/dbspace/%U
ExecStartPre=-/usr/bin/chmod 0701 /run/aul/dbspace/%U
ExecStartPre=-/usr/bin/mkdir -p /run/aul/log/widget/%U
app_info_->GetAppId());
CheckAndPrepareDebugging();
SigchldManager::UnblockSigchld();
- Util::DeleteSocketPath(getpid(), getuid());
+ Util::DeleteSocketDirectory(getpid());
int ret = Prepare();
if (ret < 0) {
on_boot_timer_ = 0;
}
-
client_channel_.reset();
if (client_socket_) {
ProcessPool::RemoveFdFromCloseableFds(client_socket_->GetFd());
_E("Failed to attach resources to loader process");
}
- Util::DeleteSocketPath(pid_, getuid());
+ Util::DeleteSocketDirectory(pid_);
tizen_base::Parcel parcel;
parcel.WriteParcelable(*app_info);
size_t data_size = parcel.GetDataSize();
void DoAtFork() {
_W("pid: %d", pid_);
try {
- std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" +
- std::to_string(pid_);
- DeleteSocketPath(fs::path(path));
+ std::string dir_path = "/run/aul/apps/" + std::to_string(pid_);
+ DeleteDirectory(fs::path(dir_path));
+
DeleteUnusedFiles();
_W("Delete done");
} catch (const std::filesystem::filesystem_error& e) {
}
private:
- void DeleteSocketPath(const fs::path& path) {
+ void DeleteDirectory(const fs::path& path) {
try {
fs::remove_all(path);
} catch (const fs::filesystem_error& e) {
}
void SocketGarbadgeCollector() {
- std::string path = "/run/aul/apps/" + std::to_string(getuid());
+ std::string path = "/run/aul/apps/";
for (const auto& entry : fs::directory_iterator(path)) {
if (!isdigit(entry.path().filename().string()[0])) continue;
std::string proc_path = "/proc/" + entry.path().filename().string();
- if (!fs::exists(proc_path)) DeleteSocketPath(entry.path());
+ if (!fs::exists(proc_path)) DeleteDirectory(entry.path());
}
}
SetGadgetPkgIdsEnvironments(b);
}
-void Util::DeleteSocketPath(pid_t pid, uid_t uid) {
- std::string path ="/run/aul/apps/" + std::to_string(uid) + "/" +
- std::to_string(pid);
+void Util::DeleteSocketDirectory(pid_t pid) {
+ std::string path ="/run/aul/apps/" + std::to_string(pid);
if (!fs::exists(path))
return;
int Util::PrepareAppSocket() {
try {
std::error_code ec;
- std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" +
- std::to_string(getpid());
+ std::string path = "/run/aul/apps/" + std::to_string(getpid());
if(access(path.c_str(), F_OK) == 0 && fs::remove_all(path, ec)) {
_E("Directory exist, but failed to remove it. path=%s, error_code=%d(%s)",
path.c_str(), ec.value(), ec.message().c_str());
return -1;
}
- if (!fs::create_directory(path, ec)) {
+ if (!fs::create_directories(path, ec)) {
_E("Failed to create directory. path=%s, error_code=%d(%s)",
path.c_str(), ec.value(), ec.message().c_str());
return -1;
}
int Util::PrepareAppIdFile(const AppInfo* app_info) {
- std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" +
- std::to_string(getpid()) + "/" + app_info->GetAppId();
+ std::string path = std::format("/run/aul/apps/{}/{}",
+ getpid(), app_info->GetAppId());
std::ofstream stream(path);
stream.close();
return 0;
class EXPORT_API Util {
public:
static void SetEnvironments(const AppInfo* app_info);
- static void DeleteSocketPath(pid_t pid, uid_t uid);
+ static void DeleteSocketDirectory(pid_t pid);
static int EnableExternalPackage(const AppInfo* app_info);
static int MountResourceDirectories(const AppInfo* app_info);
static int MountGadgetDirectories(const tizen_base::Bundle& b);