chiark / gitweb /
logind: unify how we cast between uid_t and pointers for hashmap keys
[elogind.git] / src / login / logind-user.c
index f865afdb53a3ddcb6be115aebd337e2d86171d90..49c373b50dad738c8f5ce5829d06c2c73d90ff80 100644 (file)
@@ -56,7 +56,7 @@ User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
         if (asprintf(&u->state_file, "/run/systemd/users/"UID_FMT, uid) < 0)
                 goto fail;
 
-        if (hashmap_put(m->users, ULONG_TO_PTR((unsigned long) uid), u) < 0)
+        if (hashmap_put(m->users, UID_TO_PTR(uid), u) < 0)
                 goto fail;
 
         u->manager = m;
@@ -97,7 +97,7 @@ void user_free(User *u) {
 
         free(u->runtime_path);
 
-        hashmap_remove(u->manager->users, ULONG_TO_PTR((unsigned long) u->uid));
+        hashmap_remove(u->manager->users, UID_TO_PTR(u->uid));
 
         free(u->name);
         free(u->state_file);
@@ -511,7 +511,7 @@ static int user_remove_runtime_path(User *u) {
                 log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
 
         if (umount2(u->runtime_path, MNT_DETACH) < 0)
-                log_error("Failed to unmount user runtime directory %s: %m", u->runtime_path);
+                log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", u->runtime_path);
 
         r = rm_rf(u->runtime_path, false, true, false);
         if (r < 0)