MCPcopy Create free account
hub / github.com/ioi/isolate / get_credentials

Function get_credentials

isolate.c:1020–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018}
1019
1020static void
1021get_credentials(void)
1022{
1023 if (geteuid())
1024 die("Must be started as root");
1025 if (getegid() && setegid(0) < 0)
1026 die("Cannot switch to root group: %m");
1027
1028 orig_uid = getuid();
1029 orig_gid = getgid();
1030 invoked_by_root = !orig_uid;
1031
1032 if (as_uid >= 0 || as_gid >= 0)
1033 {
1034 if (!invoked_by_root)
1035 die("You must be root to use --as-uid or --as-gid");
1036 if (as_uid < 0 || as_gid < 0)
1037 die("--as-uid and --as-gid must be used either both or none");
1038 orig_uid = as_uid;
1039 orig_gid = as_gid;
1040 }
1041}
1042
1043static void
1044do_cleanup(void)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…