chdir, setgroups
This commit is contained in:
parent
6df61db060
commit
dde8eeb39a
|
@ -466,8 +466,12 @@ void handleDiffHook(bool allowVfork, uid_t uid, uid_t gid, Path tryA, Path tryB,
|
||||||
auto diffHook = settings.diffHook;
|
auto diffHook = settings.diffHook;
|
||||||
if (diffHook != "" && settings.runDiffHook) {
|
if (diffHook != "" && settings.runDiffHook) {
|
||||||
auto wrapper = [&]() {
|
auto wrapper = [&]() {
|
||||||
|
if (chdir("/") == -1)
|
||||||
|
throw SysError("chdir / failed");
|
||||||
if (setgid(gid) == -1)
|
if (setgid(gid) == -1)
|
||||||
throw SysError("setgid failed");
|
throw SysError("setgid failed");
|
||||||
|
if (setgroups(0, 0) == -1)
|
||||||
|
throw SysError("setgroups failed");
|
||||||
if (setuid(uid) == -1)
|
if (setuid(uid) == -1)
|
||||||
throw SysError("setuid failed");
|
throw SysError("setuid failed");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue