[dconf] dconf update: more lockdown fixes
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] dconf update: more lockdown fixes
- Date: Fri, 6 May 2011 10:12:28 +0000 (UTC)
commit e7dcf8d6e9e5c184b1302d0c731f632ab8466f1d
Author: Ryan Lortie <desrt desrt ca>
Date: Fri May 6 12:04:51 2011 +0200
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)
bin/dconf-update.vala | 12 +++++++++---
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. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]