summaryrefslogtreecommitdiff
path: root/dconf-0.40.0-permissions.patch
blob: 151b790546b4a78e2375725135e6b4e6f61744e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- a/gvdb/gvdb-builder.c
+++ b/gvdb/gvdb-builder.c
@@ -21,6 +21,7 @@
 #include "gvdb-format.h"
 
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <fcntl.h>
 #if !defined(G_OS_WIN32) || !defined(_MSC_VER)
 #include <unistd.h>
@@ -509,13 +510,20 @@ gvdb_table_write_contents (GHashTable   *table,
   gboolean status;
   FileBuilder *fb;
   GString *str;
+  GStatBuf buf;
+  gint stat_ret;
 
   fb = file_builder_new (byteswap);
   file_builder_add_hash (fb, table, &root);
   str = file_builder_serialise (fb, root);
 
+  stat_ret = g_stat (filename, &buf);
+
   status = g_file_set_contents (filename, str->str, str->len, error);
   g_string_free (str, TRUE);
 
+  if (stat_ret == 0)
+    g_chmod (filename, buf.st_mode);
+
   return status;
 }