diff options
author | Ian Douglas Scott <idscott@system76.com> | 2021-06-22 19:19:14 -0700 |
---|---|---|
committer | Zeeshan Ali <zeeshanak@gnome.org> | 2021-08-12 00:19:25 +0200 |
commit | 77b432072f481a7d7edd94d307657b24d85cb350 (patch) | |
tree | 7c2cd7e61c05351e9f3d14be1dabff1ed9038f81 | |
parent | 2de651b6590087a2df2defe8f3d85b3cf6b91494 (diff) | |
download | geoclue-2.5.x.tar.gz |
client-info: Check for `app-flatpak-` prefix in `get_xdg_id`2.5.x
Seems to be the correct prefix to check for as of
https://github.com/flatpak/flatpak/commit/0c291cf1c9251a93a7bb893ee8e0371e588e05dc.
(Which follows a change in
https://github.com/flatpak/flatpak/commit/e481e3ea58e515e6e88673fac908be941c882569.)
Seems to fix recognition of Flatpak apps on Pop!_OS 21.04 beta.
Otherwise Flatpak apps are recognized as "system apps", and are always
authorized without invoking the agent.
-rw-r--r-- | src/gclue-client-info.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gclue-client-info.c b/src/gclue-client-info.c index d609b34..6a775bf 100644 --- a/src/gclue-client-info.c +++ b/src/gclue-client-info.c @@ -202,19 +202,24 @@ get_xdg_id (guint32 pid) g_autofree char *scope = NULL; const char *name; char *dash; + const char *prefix = NULL; if (!g_str_has_prefix (lines[i], "1:name=systemd:")) continue; scope = g_path_get_basename (unit); - if ((!g_str_has_prefix (scope, "xdg-app-") && - !g_str_has_prefix (scope, "flatpak-")) || - !g_str_has_suffix (scope, ".scope")) + + if (g_str_has_prefix (scope, "xdg-app-")) + prefix = "xdg-app-"; + else if (g_str_has_prefix (scope, "flatpak-")) + prefix = "flatpak-"; + else if (g_str_has_prefix (scope, "app-flatpak-")) + prefix = "app-flatpak-"; + + if (prefix == NULL || !g_str_has_suffix (scope, ".scope")) break; - /* strlen("flatpak-") == strlen("xdg-app-") - * so all is good here */ - name = scope + strlen("xdg-app-"); + name = scope + strlen(prefix); dash = strchr (name, '-'); if (dash == NULL) |