dconf/SOURCES/dconf-0.28.0-permissions.patch

32 lines
751 B
Diff
Raw Normal View History

2021-03-30 13:19:59 +00:00
--- 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;
}