summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-11-09 13:23:09 -0500
committerRyan Lortie <desrt@desrt.ca>2012-11-09 13:25:05 -0500
commitef0ba9c225c6b84de77c46a6b39dec071f2378af (patch)
tree401f5a05477b4472d8b7ed258d9338018b95b737
parent68135f2c31529309faa6bc2e8faa7f7712fe6fa2 (diff)
downloaddconf-ef0ba9c225c6b84de77c46a6b39dec071f2378af.tar.gz
service/: always use read() for reading gvdb
More NFS safety: never mmap() a gvdb on the service side.
-rw-r--r--service/dconf-gvdb-utils.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/service/dconf-gvdb-utils.c b/service/dconf-gvdb-utils.c
index 79291d3..9e0c4b1 100644
--- a/service/dconf-gvdb-utils.c
+++ b/service/dconf-gvdb-utils.c
@@ -33,9 +33,18 @@ dconf_gvdb_utils_read_file (const gchar *filename,
{
DConfChangeset *database;
GError *my_error = NULL;
- GvdbTable *table;
+ GvdbTable *table = NULL;
+ gchar *contents;
+ gsize size;
- table = gvdb_table_new (filename, FALSE, &my_error);
+ if (g_file_get_contents (filename, &contents, &size, &my_error))
+ {
+ GBytes *bytes;
+
+ bytes = g_bytes_new_take (contents, size);
+ table = gvdb_table_new_from_bytes (bytes, FALSE, &my_error);
+ g_bytes_unref (bytes);
+ }
/* It is perfectly fine if the file does not exist -- then it's
* just empty.