summaryrefslogtreecommitdiff
path: root/backends/markup-tree.c
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2007-03-05 16:11:37 +0000
committerRay Strode <halfline@src.gnome.org>2007-03-05 16:11:37 +0000
commit9ccaf1f489477a8a098dbad7f5c93a78facf7939 (patch)
tree7865c8bee74ccdd7b55e06e22921dcf1d8770411 /backends/markup-tree.c
parentb56d9841466e8df859b12ecc90128f4bc9631b08 (diff)
downloadgconf-9ccaf1f489477a8a098dbad7f5c93a78facf7939.tar.gz
Patch from Loïc Minier to take care of fallout from bug 314343.
2007-03-05 Ray Strode <rstrode@redhat.com> Patch from Loïc Minier to take care of fallout from bug 314343. * gconf/backends/markup-tree.c (save_tree): Rename markup file to its final destination, even if there wasn't an original file to copy file attributes from (bug 414916). svn path=/trunk/; revision=2382
Diffstat (limited to 'backends/markup-tree.c')
-rw-r--r--backends/markup-tree.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/backends/markup-tree.c b/backends/markup-tree.c
index 2e7434cd..ac69c0c7 100644
--- a/backends/markup-tree.c
+++ b/backends/markup-tree.c
@@ -4490,8 +4490,22 @@ save_tree_with_locale (MarkupDir *dir,
target_renamed = (g_rename (filename, tmp_filename) == 0);
#endif
- if (g_stat (filename, &st) != 0)
- goto out;
+#ifndef G_OS_WIN32
+ if (g_stat (filename, &st) == 0) {
+ /* Restore permissions. There is not much error checking we can do
+ * here. The final data is saved anyways. Note the order:
+ * mode, uid+gid, gid, uid, mode.
+ */
+ chmod (new_filename, st.st_mode);
+ if (chown (new_filename, st.st_uid, st.st_gid) < 0)
+ {
+ /* We cannot set both. Maybe we can set one. */
+ chown (new_filename, -1, st.st_gid);
+ chown (new_filename, st.st_uid, -1);
+ }
+ chmod (new_filename, st.st_mode);
+ }
+#endif
if (g_rename (new_filename, filename) < 0)
{
@@ -4503,23 +4517,6 @@ save_tree_with_locale (MarkupDir *dir,
#endif
goto out;
}
-#ifndef G_OS_WIN32
- else
- {
- /* Restore permissions. There is not much error checking we can do
- * here. The final data is saved anyways. Note the order:
- * mode, uid+gid, gid, uid, mode.
- */
- chmod (filename, st.st_mode);
- if (chown (filename, st.st_uid, st.st_gid) < 0)
- {
- /* We cannot set both. Maybe we can set one. */
- chown (filename, -1, st.st_gid);
- chown (filename, st.st_uid, -1);
- }
- chmod (filename, st.st_mode);
- }
-#endif
#ifdef G_OS_WIN32
if (target_renamed)