Manager: Set process group ID before user ID
setegid() needs to be called before seteuid(); otherwise, the setegid() call will fail because the process no longer has root privileges.
This commit is contained in:
+1
-1
@@ -190,8 +190,8 @@ void Dotfile::sync(SyncType type,
|
|||||||
auto copy = [&root, &printError](const std::filesystem::path& from,
|
auto copy = [&root, &printError](const std::filesystem::path& from,
|
||||||
const std::filesystem::path& to, bool homePath) -> void {
|
const std::filesystem::path& to, bool homePath) -> void {
|
||||||
if (homePath && root) {
|
if (homePath && root) {
|
||||||
seteuid(Machine::the().uid());
|
|
||||||
setegid(Machine::the().gid());
|
setegid(Machine::the().gid());
|
||||||
|
seteuid(Machine::the().uid());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create directory for the file
|
// Create directory for the file
|
||||||
|
|||||||
Reference in New Issue
Block a user