diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index e99cf059c8..9e3fe04c76 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -83,6 +83,13 @@ ErrorOr ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destinati int rc = syscall(SC_ptrace, ¶ms); HANDLE_SYSCALL_RETURN_VALUE("ptrace_peekbuf", rc, {}); } + +ErrorOr setgroups(Span gids) +{ + if (::setgroups(gids.size(), gids.data()) < 0) + return Error::from_syscall("setgroups"sv, -errno); + return {}; +} #endif ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action) diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index f942c51c40..b552db968b 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -26,6 +26,7 @@ ErrorOr> pipe2(int flags); ErrorOr sendfd(int sockfd, int fd); ErrorOr recvfd(int sockfd, int options); ErrorOr ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf); +ErrorOr setgroups(Span); #endif ErrorOr sigaction(int signal, struct sigaction const* action, struct sigaction* old_action);