SystemServer: Print useful information when failing to drop privileges
It occurred to me that when trying to running "pls pro SOME_URL" with a subsequent failure (which will be fixed in a future patch), that a small error message was printed to the debug log about "Failed to drop privileges (GID=0, UID=0)". To actually understand where it failed, I added the actual errno to printed message which helped me with further debugging, but this could easily help others in similar scenarios so let's print the actual error.
This commit is contained in:
parent
2a051738ca
commit
f7185dfa91
Notes:
sideshowbarker
2024-07-16 19:57:56 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/f7185dfa91 Pull-request: https://github.com/SerenityOS/serenity/pull/18942 Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 2 deletions
|
@ -200,8 +200,8 @@ ErrorOr<void> Service::spawn(int socket_fd)
|
|||
|
||||
if (m_account.has_value() && m_account.value().uid() != getuid()) {
|
||||
auto& account = m_account.value();
|
||||
if (account.login().is_error()) {
|
||||
dbgln("Failed to drop privileges (GID={}, UID={})\n", account.gid(), account.uid());
|
||||
if (auto error_or_void = account.login(); error_or_void.is_error()) {
|
||||
dbgln("Failed to drop privileges (GID={}, UID={}), due to {}\n", account.gid(), account.uid(), error_or_void.error());
|
||||
exit(1);
|
||||
}
|
||||
TRY(Core::System::setenv("HOME"sv, account.home_directory(), true));
|
||||
|
|
Loading…
Add table
Reference in a new issue