From 51eff7c805f15f83dfceaac3ba6740a8a624a4d3 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sun, 18 Nov 2007 23:42:24 +0100 Subject: [PATCH] assign pid to a gint64 before passing it as an _INT64 in a dbus message This patch assigns a GPid to an gint64 before passing as a DBUS_TYPE_INT64 in a dbus message. Fixes alignment issues and ensures the correct size of the passed argument without the need to use __attribute__ ((aligned)) --- hald-runner/main.c | 5 +++-- hald-runner/runner.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hald-runner/main.c b/hald-runner/main.c index f767b9b..accb65d 100644 --- a/hald-runner/main.c +++ b/hald-runner/main.c @@ -137,7 +137,7 @@ handle_start(DBusConnection *con, DBusMessage *msg, gboolean is_singleton) DBusMessage *reply; DBusMessageIter iter; run_request *r; - GPid pid __attribute__ ((aligned)); + GPid pid; r = new_run_request(); r->is_singleton = is_singleton; @@ -158,9 +158,10 @@ handle_start(DBusConnection *con, DBusMessage *msg, gboolean is_singleton) } if (run_request_run(r, con, NULL, &pid)) { + gint64 ppid = pid; reply = dbus_message_new_method_return(msg); dbus_message_append_args (reply, - DBUS_TYPE_INT64, &pid, + DBUS_TYPE_INT64, &ppid, DBUS_TYPE_INVALID); } else { diff --git a/hald-runner/runner.c b/hald-runner/runner.c index cd6cf82..4847655 100644 --- a/hald-runner/runner.c +++ b/hald-runner/runner.c @@ -181,11 +181,12 @@ out: /* emit a signal that this PID exited */ if(rd->con != NULL && rd->emit_pid_exited) { DBusMessage *signal; + gint64 ppid = rd->pid; signal = dbus_message_new_signal ("/org/freedesktop/HalRunner", "org.freedesktop.HalRunner", "StartedProcessExited"); dbus_message_append_args (signal, - DBUS_TYPE_INT64, &(rd->pid), + DBUS_TYPE_INT64, &(ppid), DBUS_TYPE_INVALID); dbus_connection_send(rd->con, signal, NULL); } -- 1.5.3.7