summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-09 16:25:47 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-09 18:35:36 +0100
commit8cb4ab0058e51f1fba93683d145ef95f97c2fa86 (patch)
tree022bbd937efd224d8de1e2c5db66331a6149ed74 /src/login
parent309a29dfd24f4175de334ca1593e3fe2436ab082 (diff)
logind: unify how we cast between uid_t and pointers for hashmap keys
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-core.c2
-rw-r--r--src/login/logind-dbus.c4
-rw-r--r--src/login/logind-session.c2
-rw-r--r--src/login/logind-user-dbus.c2
-rw-r--r--src/login/logind-user.c4
5 files changed, 7 insertions, 7 deletions
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index 88694f9bac..a6ff5add95 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -101,7 +101,7 @@ int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **
assert(m);
assert(name);
- u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
+ u = hashmap_get(m->users, UID_TO_PTR(uid));
if (!u) {
u = user_new(m, uid, gid, name);
if (!u)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 3ff6cd398f..bc985a3754 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -92,7 +92,7 @@ int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid,
return r;
}
- user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
+ user = hashmap_get(m->users, UID_TO_PTR(uid));
if (!user)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
@@ -1157,7 +1157,7 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
if (r < 0 && errno != ENOENT)
return -errno;
- u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
+ u = hashmap_get(m->users, UID_TO_PTR(uid));
if (u)
user_add_to_gc_queue(u);
}
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index ea1831dac6..a51f9f3e0f 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -355,7 +355,7 @@ int session_load(Session *s) {
return r;
}
- user = hashmap_get(s->manager->users, ULONG_TO_PTR((unsigned long) u));
+ user = hashmap_get(s->manager->users, UID_TO_PTR(u));
if (!user) {
log_error("User of session %s not known.", s->id);
return -ENOENT;
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index 717740ad04..bff42e89ad 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -270,7 +270,7 @@ int user_object_find(sd_bus *bus, const char *path, const char *interface, void
if (r < 0)
return 0;
- user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
+ user = hashmap_get(m->users, UID_TO_PTR(uid));
if (!user)
return 0;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 9ff1302663..49c373b50d 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -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);