Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit daf60339 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix the cgroup directory owner in createProcessGroupInternal()"

parents 9f6770e6 812d7698
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -460,7 +460,6 @@ static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgr


    struct stat cgroup_stat;
    struct stat cgroup_stat;
    mode_t cgroup_mode = 0750;
    mode_t cgroup_mode = 0750;
    uid_t cgroup_uid = AID_SYSTEM;
    gid_t cgroup_gid = AID_SYSTEM;
    gid_t cgroup_gid = AID_SYSTEM;
    int ret = 0;
    int ret = 0;


@@ -468,11 +467,10 @@ static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgr
        PLOG(ERROR) << "Failed to get stats for " << cgroup;
        PLOG(ERROR) << "Failed to get stats for " << cgroup;
    } else {
    } else {
        cgroup_mode = cgroup_stat.st_mode;
        cgroup_mode = cgroup_stat.st_mode;
        cgroup_uid = cgroup_stat.st_uid;
        cgroup_gid = cgroup_stat.st_gid;
        cgroup_gid = cgroup_stat.st_gid;
    }
    }


    if (!MkdirAndChown(uid_path, cgroup_mode, cgroup_uid, cgroup_gid)) {
    if (!MkdirAndChown(uid_path, cgroup_mode, uid, cgroup_gid)) {
        PLOG(ERROR) << "Failed to make and chown " << uid_path;
        PLOG(ERROR) << "Failed to make and chown " << uid_path;
        return -errno;
        return -errno;
    }
    }
@@ -486,7 +484,7 @@ static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgr


    auto uid_pid_path = ConvertUidPidToPath(cgroup.c_str(), uid, initialPid);
    auto uid_pid_path = ConvertUidPidToPath(cgroup.c_str(), uid, initialPid);


    if (!MkdirAndChown(uid_pid_path, cgroup_mode, cgroup_uid, cgroup_gid)) {
    if (!MkdirAndChown(uid_pid_path, cgroup_mode, uid, cgroup_gid)) {
        PLOG(ERROR) << "Failed to make and chown " << uid_pid_path;
        PLOG(ERROR) << "Failed to make and chown " << uid_pid_path;
        return -errno;
        return -errno;
    }
    }