1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibC: Add support for POSIX_SPAWN_RESETIDS

This is possible now that seteuid() / setegid() are implemented.
This commit is contained in:
Nico Weber 2020-06-19 08:22:47 -04:00 committed by Andreas Kling
parent 35c4a4971a
commit e89a82a476

View file

@ -48,6 +48,16 @@ extern "C" {
}
if (attr) {
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 (setpgid(0, attr->pgroup) < 0) {
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);