mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-04 21:08:14 +02:00
sysdeps: Give a more useful error if unable to resolve a numeric uid
If we want to get the struct passwd corresponding to uid 42, but we
can't, it's much better to say
User ID "42" unknown
rather than
User "???" unknown
Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
80b90e570e
commit
12b367daaa
1 changed files with 13 additions and 4 deletions
|
|
@ -2797,10 +2797,19 @@ fill_user_info (DBusUserInfo *info,
|
|||
}
|
||||
else
|
||||
{
|
||||
dbus_set_error (error, _dbus_error_from_errno (errno),
|
||||
"User \"%s\" unknown or no memory to allocate password entry\n",
|
||||
username_c ? username_c : "???");
|
||||
_dbus_verbose ("User %s unknown\n", username_c ? username_c : "???");
|
||||
DBusError local_error = DBUS_ERROR_INIT;
|
||||
|
||||
if (uid != DBUS_UID_UNSET)
|
||||
dbus_set_error (&local_error, _dbus_error_from_errno (errno),
|
||||
"User ID " DBUS_UID_FORMAT " unknown or no memory to allocate password entry",
|
||||
uid);
|
||||
else
|
||||
dbus_set_error (&local_error, _dbus_error_from_errno (errno),
|
||||
"User \"%s\" unknown or no memory to allocate password entry\n",
|
||||
username_c ? username_c : "???");
|
||||
|
||||
_dbus_verbose ("%s", local_error.message);
|
||||
dbus_move_error (&local_error, error);
|
||||
dbus_free (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue