summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-05-06 12:04:51 +0200
committerRyan Lortie <desrt@desrt.ca>2011-05-06 12:06:36 +0200
commite7dcf8d6e9e5c184b1302d0c731f632ab8466f1d (patch)
tree0af2129dcce67385febc36598526f3215017eb3e
parent62e6a751886e1030fa0d4d062fde009c67a6a544 (diff)
downloaddconf-e7dcf8d6e9e5c184b1302d0c731f632ab8466f1d.tar.gz
dconf update: more lockdown fixes
- regenerate the file when the lock dir timestamp changes - send the proper dbus message - write an actual value for the lock in the GVDB (otherwise the reader won't see it)
-rw-r--r--bin/dconf-update.vala12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala
index 0eaf728..841fbfa 100644
--- a/bin/dconf-update.vala
+++ b/bin/dconf-update.vala
@@ -65,7 +65,7 @@ Gvdb.HashTable? read_locks_directory (string dirname) throws GLib.Error {
foreach (var line in contents.split ("\n")) {
if (line.has_prefix ("/")) {
- table.insert (line);
+ table.insert_string (line, "");
}
}
}
@@ -147,10 +147,16 @@ void maybe_update_from_directory (string dirname) throws GLib.Error {
Posix.Stat dir_buf;
if (Posix.stat (dirname, out dir_buf) == 0 && Posix.S_ISDIR (dir_buf.st_mode)) {
+ Posix.Stat lockdir_buf;
Posix.Stat file_buf;
var filename = dirname.substring (0, dirname.length - 2);
+ if (Posix.stat (dirname + "/locks", out lockdir_buf) == 0 && lockdir_buf.st_mtime > dir_buf.st_mtime) {
+ // if the lock directory has been updated more recently then consider its timestamp instead
+ dir_buf.st_mtime = lockdir_buf.st_mtime;
+ }
+
if (Posix.stat (filename, out file_buf) == 0 && file_buf.st_mtime > dir_buf.st_mtime) {
return;
}
@@ -178,8 +184,8 @@ void maybe_update_from_directory (string dirname) throws GLib.Error {
try {
var system_bus = Bus.get_sync (BusType.SYSTEM);
- system_bus.emit_signal (null, "/" + Path.get_basename (filename), "ca.desrt.dconf.Writer", "Notify",
- new Variant ("(tsas)", (uint64) 0, "/", new VariantBuilder (STRING_ARRAY)));
+ system_bus.emit_signal (null, "/ca/desrt/dconf/Writer/" + Path.get_basename (filename), "ca.desrt.dconf.Writer",
+ "WritabilityNotify", new Variant ("(s)", "/"));
flush_the_bus (system_bus);
} catch {
/* if we can't, ... don't. */