Debian Codegraph @

src/actions/gsm_gnomesu.cpp

raw symbols SCIP
1 /*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 */
4
5 #include "config.h"
6
7 #include <glib.h>
8 #include <gmodule.h>
9
10 #include "gsm_gnomesu.h"
11
12
13 gboolean (*gnomesu_exec) (const char *commandline);
14
15
16 static void
17 load_gnomesu (void)
18 {
19 static GModule *module = NULL;
20
21 if (g_once_init_enter_pointer (&module)) {
22 GModule *gnomesu = g_module_open ("libgnomesu.so.0",
23 static_cast<GModuleFlags>(G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL));
24
25 if (!g_module_symbol (gnomesu, "gnomesu_exec", (gpointer *) &gnomesu_exec)) {
26 g_debug ("Could not load gnomesu_exec from libgnomesu.so.0");
27 return;
28 } else {
29 g_debug ("Loaded gnomesu_exec from libgnomesu.so.0");
30 }
31
32 g_once_init_leave_pointer (&module, g_steal_pointer (&gnomesu));
33 }
34 }
35
36
37 gboolean
38 gsm_gnomesu_create_root_password_dialog (const char *command)
39 {
40 return gnomesu_exec (command);
41 }
42
43
44 gboolean
45 procman_has_gnomesu (void)
46 {
47 load_gnomesu ();
48 return gnomesu_exec != NULL;
49 }