run: Don't install polkit agent for enter/run/build

Neither of these ever need a polkit agent, and run/build are somewhat
performance sensitive and we don't want to connect to dbus unnecessarily.
For enter this is critical though, as the dbus connection starts a thread
which is not compatible with the setns syscall.
This commit is contained in:
Alexander Larsson
2019-11-19 16:08:25 +01:00
committed by Alexander Larsson
parent 7079c6c722
commit 180494ca41

View File

@@ -745,7 +745,12 @@ flatpak_run (int argc,
check_environment ();
polkit_agent = install_polkit_agent ();
/* Don't talk to dbus in enter, as it must be thread-free to setns, also
skip run/build for performance reasons (no need to connect to dbus). */
if (g_strcmp0 (command->name, "enter") != 0 &&
g_strcmp0 (command->name, "run") != 0 &&
g_strcmp0 (command->name, "build") != 0)
polkit_agent = install_polkit_agent ();
if (!command->fn (argc, argv, cancellable, &error))
goto out;