dir: fix build when HAVE_LIBSYSTEMD but not USE_SYSTEM_HELPER

polkit_subject_to_string() is called inside the HAVE_LIBSYSTEMD guard
in flatpak_dir_log(), but <polkit/polkit.h> is only included when
USE_SYSTEM_HELPER is defined. This causes a build failure on
configurations that have libsystemd but no system helper.

Guard the polkit call with USE_SYSTEM_HELPER and fall back to "(none)"
so the subject string is always valid for the sd_journal_send() call.

Fixes: f9d5c5c ("dir: Free result of polkit_subject_to_string")
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
This commit is contained in:
Rudi Heitbaum
2026-05-09 06:37:44 +00:00
committed by bbhtt
parent 3daccaeadc
commit 68ffa487ee

View File

@@ -17463,7 +17463,11 @@ static void
va_list args;
installation = source ? source : flatpak_dir_get_name_cached (self);
#ifdef USE_SYSTEM_HELPER
subject = self->subject ? polkit_subject_to_string (self->subject) : g_strdup ("(none)");
#else
subject = g_strdup ("(none)");
#endif
len = g_snprintf (message, sizeof (message), "%s: ", installation);