aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools
diff options
context:
space:
mode:
authorGravatar Daniel Wagner-Hall <danielwh@google.com>2015-05-20 22:22:16 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-05-21 09:50:44 +0000
commite22f76c69dbcacd26b76e522c28a4deed5675247 (patch)
tree335cfcc672851a82f300ea03d50072d2a1378759 /src/main/tools
parent828c5441b0cb4af1435c9c20d21a5ebc6da83ec7 (diff)
Set gid as well as uid
-- MOS_MIGRATED_REVID=94131018
Diffstat (limited to 'src/main/tools')
-rw-r--r--src/main/tools/process-wrapper.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/tools/process-wrapper.c b/src/main/tools/process-wrapper.c
index a6c66012ae..7935555cbd 100644
--- a/src/main/tools/process-wrapper.c
+++ b/src/main/tools/process-wrapper.c
@@ -164,6 +164,15 @@ int main(int argc, char *argv[]) {
}
}
+ int gid = getgid();
+ int egid = getegid();
+ if (gid != egid) {
+ // Switch completely to the target gid.
+ if (setregid(egid, egid) != 0) {
+ DIE("changing gid failed: setregid");
+ }
+ }
+
// Parse the cmdline args to get the timeout and redirect files.
argv++;
double timeout;