-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foospawnpolkitagenthfoo
-#define foospawnpolkitagenthfoo
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
/***
This file is part of systemd.
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "bus-util.h"
+
int polkit_agent_open(void);
void polkit_agent_close(void);
-#endif
+static inline void polkit_agent_open_if_enabled(
+ BusTransport transport,
+ bool ask_password) {
+
+ /* Open the polkit agent as a child process if necessary */
+
+ if (transport != BUS_TRANSPORT_LOCAL)
+ return;
+
+ if (!ask_password)
+ return;
+
+ polkit_agent_open();
+}