From ef0ba9c225c6b84de77c46a6b39dec071f2378af Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Fri, 9 Nov 2012 13:23:09 -0500 Subject: service/: always use read() for reading gvdb More NFS safety: never mmap() a gvdb on the service side. --- service/dconf-gvdb-utils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'service') 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. -- cgit v1.2.1