summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-05-20 21:59:08 +0300
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-20 21:44:03 +0200
commitf7185dfa912fa0e0dae555c2d1d7fc013b50aba5 (patch)
tree07ba307d1e67ea7ea7851bdb3eb9a45a55f7d153 /Userland/Services
parent2a051738ca3aacfb1376fb0452235e290238e5bb (diff)
downloadserenity-f7185dfa912fa0e0dae555c2d1d7fc013b50aba5.zip
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.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/SystemServer/Service.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp
index eda136ce1f..bc3190c362 100644
--- a/Userland/Services/SystemServer/Service.cpp
+++ b/Userland/Services/SystemServer/Service.cpp
@@ -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));