diff options
author | Ray Strode <rstrode@redhat.com> | 2008-12-08 15:41:28 +0000 |
---|---|---|
committer | Ray Strode <halfline@src.gnome.org> | 2008-12-08 15:41:28 +0000 |
commit | 40250d82273a1e8e8872613c791afba87ea1ad13 (patch) | |
tree | 708b7bbb92cac399ae7baceb136f4dbbec270981 /backends/markup-tree.c | |
parent | a02034a88296d59a359412b4fa393010bdf88b7a (diff) | |
download | gconf-40250d82273a1e8e8872613c791afba87ea1ad13.tar.gz |
Use fsync instead of fdatasync for portability (bug 563401). Also flush
2008-12-08 Ray Strode <rstrode@redhat.com>
* gconf/gconfd.c: (logfile_save):
Use fsync instead of fdatasync for portability
(bug 563401).
* backends/markup-tree.c (save_tree_with_locale):
Also flush and sync here before closing (Patch
from Richard Hult, bug 562976)
svn path=/trunk/; revision=2718
Diffstat (limited to 'backends/markup-tree.c')
-rw-r--r-- | backends/markup-tree.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/backends/markup-tree.c b/backends/markup-tree.c index 72ed1a4c..5c900411 100644 --- a/backends/markup-tree.c +++ b/backends/markup-tree.c @@ -4386,6 +4386,7 @@ save_tree_with_locale (MarkupDir *dir, */ if (dir->entries == NULL && (!save_as_subtree || dir->subdirs == NULL)) { + fsync (new_fd); close (new_fd); new_fd = -1; goto done_writing; @@ -4466,6 +4467,13 @@ save_tree_with_locale (MarkupDir *dir, goto done_writing; } + if (fflush (f) != 0 || fsync (fileno (f)) < 0) + { + gconf_log (GCL_WARNING, + _("Could not flush file '%s' to disk: %s"), + new_filename, g_strerror (errno)); + } + if (fclose (f) < 0) { f = NULL; /* f is still freed even if fclose fails according to the |