Commit a6c28fea by Alberto Mardegan

Fix endianness issues

We cannot safely load a 32 bit integer into a struct field which expects
a 64 bit value: we must load it into a 32 bit integer first, and then
assign the value to the structure field.

This bug was causing test failures on s390x:
#2
parent e3637815
Pipeline #575740 skipped
......@@ -291,8 +291,10 @@ _ag_account_build_dbus_changes (AgAccount *account, AgAccountChanges *changes,
if (ts)
{
g_variant_builder_add (&builder, "u", ts->tv_sec);
g_variant_builder_add (&builder, "u", ts->tv_nsec);
guint32 sec = ts->tv_sec;
guint32 nsec = ts->tv_nsec;
g_variant_builder_add (&builder, "u", sec);
g_variant_builder_add (&builder, "u", nsec);
}
g_variant_builder_add (&builder, "u", account->id);
g_variant_builder_add (&builder, "b", changes->created);
......
......@@ -699,16 +699,18 @@ dbus_filter_callback (G_GNUC_UNUSED GDBusConnection *dbus_conn,
if (!object_path_is_interesting (object_path, priv->object_paths))
return;
memset (&ts, 0, sizeof (struct timespec));
guint32 sec, nsec;
g_variant_get (msg,
"(uuubb&s@*)",
&ts.tv_sec,
&ts.tv_nsec,
&sec,
&nsec,
&account_id,
&created,
&deleted,
&provider_name,
&v_services);
ts.tv_sec = sec;
ts.tv_nsec = nsec;
DEBUG_INFO ("path = %s, time = %lu-%lu (%p)",
object_path, ts.tv_sec, ts.tv_nsec,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment