chiark / gitweb /
logind: fix build for ARM with sizeof(dev_t) > sizeof(void*)
[elogind.git] / src / login / logind-session-device.c
index e92bb54fffa85489e608c1b3b2714c5942ba2504..b45f9ebe0cc50ba2fa5bbf9cd641dadad8697d20 100644 (file)
@@ -369,9 +369,7 @@ int session_device_new(Session *s, dev_t dev, SessionDevice **out) {
         if (r < 0)
                 goto error;
 
-        assert_cc(sizeof(unsigned long) >= sizeof(dev_t));
-
-        r = hashmap_put(s->devices, ULONG_TO_PTR((unsigned long)sd->dev), sd);
+        r = hashmap_put(s->devices, &sd->dev, sd);
         if (r < 0) {
                 r = -ENOMEM;
                 goto error;
@@ -392,7 +390,7 @@ int session_device_new(Session *s, dev_t dev, SessionDevice **out) {
         return 0;
 
 error:
-        hashmap_remove(s->devices, ULONG_TO_PTR((unsigned long)sd->dev));
+        hashmap_remove(s->devices, &sd->dev);
         free(sd->node);
         free(sd);
         return r;
@@ -407,7 +405,7 @@ void session_device_free(SessionDevice *sd) {
 
         LIST_REMOVE(SessionDevice, sd_by_device, sd->device->session_devices, sd);
 
-        hashmap_remove(sd->session->devices, ULONG_TO_PTR((unsigned long)sd->dev));
+        hashmap_remove(sd->session->devices, &sd->dev);
 
         free(sd->node);
         free(sd);