Skip to content

Commit

Permalink
dir: Reload DBus daemon config to ensure services get picked up
Browse files Browse the repository at this point in the history
This is best effort. There is a 2s timeout and if something fails
everything continues on.

This is called from flatpak_dir_run_triggers because it gets called
whenever we might have changes to the exported service files.

Fixes flatpak#3342

Signed-off-by: Sebastian Wick <[email protected]>
(cherry picked from commit 9532c8d)
  • Loading branch information
swick authored and smcv committed Apr 22, 2024
1 parent 1afcf43 commit 40029c6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions common/flatpak-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -6997,6 +6997,28 @@ flatpak_dir_set_active (FlatpakDir *self,
return ret;
}

static void
maybe_reload_dbus_config (GCancellable *cancellable)
{
g_autoptr(GDBusConnection) session_bus = NULL;

session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, NULL);
if (!session_bus)
return;

g_dbus_connection_call_sync (session_bus,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"ReloadConfig",
NULL,
NULL,
G_DBUS_CALL_FLAGS_NONE,
2000,
cancellable,
NULL);
}

gboolean
flatpak_dir_run_triggers (FlatpakDir *self,
GCancellable *cancellable,
Expand All @@ -7009,6 +7031,8 @@ flatpak_dir_run_triggers (FlatpakDir *self,
GError *temp_error = NULL;
const char *triggerspath;

maybe_reload_dbus_config (cancellable);

if (flatpak_dir_use_system_helper (self, NULL))
{
const char *installation = flatpak_dir_get_id (self);
Expand Down

0 comments on commit 40029c6

Please sign in to comment.