summaryrefslogtreecommitdiff
path: root/src/login/logind-session-device.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-01 17:48:15 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-01 17:48:15 +0200
commit081dfa852fc5cd183a20747f2d8e4ef62d29d181 (patch)
tree5649c767b80e26fcf3c7bdceee90b2d7041bb363 /src/login/logind-session-device.c
parentea52e2aee8dd7b3f51e9a00e76a54ef12dc0e898 (diff)
logind: fix session-device dbus notify
Had this fix lying around here for some time. Thanks to missing type-checking for va-args we passed in the actual major/minor values instead of pointers to it. Fix it by saving the values on the stack first and passing in the pointers.
Diffstat (limited to 'src/login/logind-session-device.c')
-rw-r--r--src/login/logind-session-device.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
index b45f9ebe0c..27afafa1aa 100644
--- a/src/login/logind-session-device.c
+++ b/src/login/logind-session-device.c
@@ -46,9 +46,13 @@ static void session_device_notify(SessionDevice *sd, enum SessionDeviceNotificat
_cleanup_dbus_message_unref_ DBusMessage *m = NULL;
_cleanup_free_ char *path = NULL;
const char *t = NULL;
+ uint32_t major, minor;
assert(sd);
+ major = major(sd->dev);
+ minor = minor(sd->dev);
+
if (!sd->session->controller)
return;
@@ -68,8 +72,8 @@ static void session_device_notify(SessionDevice *sd, enum SessionDeviceNotificat
switch (type) {
case SESSION_DEVICE_RESUME:
if (!dbus_message_append_args(m,
- DBUS_TYPE_UINT32, major(sd->dev),
- DBUS_TYPE_UINT32, minor(sd->dev),
+ DBUS_TYPE_UINT32, &major,
+ DBUS_TYPE_UINT32, &minor,
DBUS_TYPE_UNIX_FD, &sd->fd,
DBUS_TYPE_INVALID))
return;
@@ -88,8 +92,8 @@ static void session_device_notify(SessionDevice *sd, enum SessionDeviceNotificat
}
if (t && !dbus_message_append_args(m,
- DBUS_TYPE_UINT32, major(sd->dev),
- DBUS_TYPE_UINT32, minor(sd->dev),
+ DBUS_TYPE_UINT32, &major,
+ DBUS_TYPE_UINT32, &minor,
DBUS_TYPE_STRING, &t,
DBUS_TYPE_INVALID))
return;