summaryrefslogtreecommitdiff
path: root/service/dconf-state.c
diff options
context:
space:
mode:
Diffstat (limited to 'service/dconf-state.c')
-rw-r--r--service/dconf-state.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/service/dconf-state.c b/service/dconf-state.c
index 0ed156e..a30054c 100644
--- a/service/dconf-state.c
+++ b/service/dconf-state.c
@@ -4,6 +4,8 @@
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
@@ -64,9 +66,39 @@ dconf_state_init_session (DConfState *state)
}
}
+static gboolean
+dconf_state_is_blame_mode (void)
+{
+ gint fd;
+
+ if (getenv ("DCONF_BLAME"))
+ return TRUE;
+
+ fd = open ("/proc/cmdline", O_RDONLY);
+ if (fd != -1)
+ {
+ gchar buffer[1024];
+ gssize s;
+
+ s = read (fd, buffer, sizeof buffer - 1);
+ close (fd);
+
+ if (0 < s && s < sizeof buffer)
+ {
+ buffer[s] = '\0';
+ if (strstr (buffer, "DCONF_BLAME"))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
void
dconf_state_init (DConfState *state)
{
+ state->blame_mode = dconf_state_is_blame_mode ();
+ state->blame_info = NULL;
state->is_session = strcmp (g_get_user_name (), "dconf") != 0;
state->main_loop = g_main_loop_new (NULL, FALSE);
state->serial = 0;