]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
login: use STREROR_USER helper
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Nov 2025 09:28:53 +0000 (10:28 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Nov 2025 15:23:29 +0000 (16:23 +0100)
src/login/user-runtime-dir.c
src/shared/userdb.c

index b80723b97e6a96a66fc6723bc1763dbb70dc39f2..6cf157ffada3ffa8a4c869e804230cd4c1ed1dae 100644 (file)
@@ -348,10 +348,8 @@ static int run(int argc, char *argv[]) {
         if (streq(verb, "start")) {
                 _cleanup_(user_record_unrefp) UserRecord *ur = NULL;
                 r = userdb_by_name(user, /* match= */ NULL, USERDB_PARSE_NUMERIC|USERDB_SUPPRESS_SHADOW, &ur);
-                if (r == -ESRCH)
-                        return log_error_errno(r, "User '%s' does not exist: %m", user);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to resolve user '%s': %m", user);
+                        return log_error_errno(r, "Failed to resolve user '%s': %s", user, STRERROR_USER(r));
 
                 /* We do two things here: mount the per-user XDG_RUNTIME_DIR, and set up tmpfs quota on /tmp/
                  * and /dev/shm/. */
index c7a1595211a15532e9e5f4cc9f95ce5c14ec772a..99cceb25a4c02912a05b06654f401ca5d2f17e58 100644 (file)
@@ -932,7 +932,7 @@ int userdb_by_name(const char *name, const UserDBMatch *match, UserDBFlags flags
         r = userdb_start_query(iterator, "io.systemd.UserDatabase.GetUserRecord", /* more= */ false, query, flags);
         if (r >= 0) {
                 r = userdb_process(iterator, &ur, /* ret_group_record= */ NULL, /* ret_user_name= */ NULL, /* ret_group_name= */ NULL);
-                if (r == -ENOEXEC) /* found a user matching UID or name, but not filter. In this case the
+                if (r == -ENOEXEC) /* Found a user matching UID or name, but not filter. In this case the
                                     * fallback paths below are pointless */
                         return r;
         }