Skip to content
Snippets Groups Projects
Commit 31a3a452 authored by Frederic Danis's avatar Frederic Danis
Browse files

d/patches: Add patch to fix 32bits demo app crash


Call to where-am-i on 32bits platform ends up with following error:
*** stack smashing detected ***: terminated

GTimeVal parameters are glong, which depends on the platform, but
timestamp returned by geoclue is guint64 for both seconds and useconds.
Furthermore GTimeVal is marked as deprecated.

As this app only displays time with an accuracy in seconds, we can replace
g_date_time_new_from_timeval_local() by g_date_time_new_from_unix_local().

Signed-off-by: default avatarFrédéric Danis <frederic.danis@collabora.com>
parent 53a49194
No related branches found
No related tags found
2 merge requests!14Backport d/patches: Add patch to fix 32bits demo app crash,!13d/patches: Add patch to fix 32bits demo app crash
From fb3f1b103432d238339d8ae02c533e24133bc85e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis@collabora.com>
Date: Fri, 7 Jan 2022 12:28:06 +0100
Subject: [PATCH] demo: Fix where-am-i crash on 32bits platform
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Call to where-am-i on 32bits platform ends up with following error:
*** stack smashing detected ***: terminated
GTimeVal parameters are glong, which depends on the platform, but
timestamp returned by geoclue is guint64 for both seconds and useconds.
Furthermore GTimeVal is marked as deprecated.
As this app only displays time with an accuracy in seconds, we can replace
g_date_time_new_from_timeval_local() by g_date_time_new_from_unix_local().
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
---
demo/where-am-i.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/demo/where-am-i.c b/demo/where-am-i.c
index 5934161..f8f6a43 100644
--- a/demo/where-am-i.c
+++ b/demo/where-am-i.c
@@ -84,7 +84,6 @@ print_location (GClueSimple *simple)
GClueLocation *location;
gdouble altitude, speed, heading;
GVariant *timestamp;
- GTimeVal tv = { 0 };
const char *desc;
location = gclue_simple_get_location (simple);
@@ -112,10 +111,11 @@ print_location (GClueSimple *simple)
if (timestamp) {
GDateTime *date_time;
gchar *str;
+ guint64 secs;
- g_variant_get (timestamp, "(tt)", &tv.tv_sec, &tv.tv_usec);
+ g_variant_get (timestamp, "(tt)", &secs, NULL);
- date_time = g_date_time_new_from_timeval_local (&tv);
+ date_time = g_date_time_new_from_unix_local (secs);
str = g_date_time_format
(date_time,
"%c (%s seconds since the Epoch)");
--
2.25.1
......@@ -4,3 +4,4 @@
0004-service-Stop-the-client-for-system-applications-when.patch
fix-nowifi-query.patch
0006-client-info-Support-cgroup-v2.patch
0007-demo-Fix-where-am-i-crash-on-32bits-platform.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment