mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibC: Add support for POSIX_SPAWN_RESETIDS
This is possible now that seteuid() / setegid() are implemented.
This commit is contained in:
parent
35c4a4971a
commit
e89a82a476
1 changed files with 11 additions and 1 deletions
|
@ -48,6 +48,16 @@ extern "C" {
|
||||||
}
|
}
|
||||||
if (attr) {
|
if (attr) {
|
||||||
short flags = attr->flags;
|
short flags = attr->flags;
|
||||||
|
if (flags & POSIX_SPAWN_RESETIDS) {
|
||||||
|
if (seteuid(getuid()) < 0) {
|
||||||
|
perror("posix_spawn seteuid");
|
||||||
|
exit(127);
|
||||||
|
}
|
||||||
|
if (setegid(getgid()) < 0) {
|
||||||
|
perror("posix_spawn setegid");
|
||||||
|
exit(127);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (flags & POSIX_SPAWN_SETPGROUP) {
|
if (flags & POSIX_SPAWN_SETPGROUP) {
|
||||||
if (setpgid(0, attr->pgroup) < 0) {
|
if (setpgid(0, attr->pgroup) < 0) {
|
||||||
perror("posix_spawn setpgid");
|
perror("posix_spawn setpgid");
|
||||||
|
@ -81,7 +91,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: POSIX_SPAWN_RESETIDS, POSIX_SPAWN_SETSCHEDULER
|
// FIXME: POSIX_SPAWN_SETSCHEDULER
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(path, argv, envp);
|
exec(path, argv, envp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue