summaryrefslogtreecommitdiff
path: root/xfconfd
diff options
context:
space:
mode:
authorBrian Tarricone <brian@tarricone.org>2009-03-11 23:35:58 +0000
committerBrian Tarricone <brian@tarricone.org>2009-03-11 23:35:58 +0000
commit860dbf59556762f5b70e9addec918915823a520e (patch)
tree89832f81c577ee8a9df38e7620e8676d540f923a /xfconfd
parentfb419473cf0f122b8ad67dd7989b6a805e47fe0c (diff)
downloadxfconf-860dbf59556762f5b70e9addec918915823a520e.tar.gz
be a bit safer when writing out channel files
(Old svn revision: 29651)
Diffstat (limited to 'xfconfd')
-rw-r--r--xfconfd/xfconf-backend-perchannel-xml.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/xfconfd/xfconf-backend-perchannel-xml.c b/xfconfd/xfconf-backend-perchannel-xml.c
index 809b094..d764e58 100644
--- a/xfconfd/xfconf-backend-perchannel-xml.c
+++ b/xfconfd/xfconf-backend-perchannel-xml.c
@@ -1,7 +1,7 @@
/*
* xfconf
*
- * Copyright (c) 2007 Brian Tarricone <bjt23@cornell.edu>
+ * Copyright (c) 2007-2009 Brian Tarricone <bjt23@cornell.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1934,6 +1934,19 @@ xfconf_backend_perchannel_xml_flush_channel(XfconfBackendPerchannelXml *xbpx,
if(fputs("</channel>\n", fp) == EOF)
goto out;
+ if(fflush(fp))
+ goto out;
+
+#if defined(HAVE_FDATASYNC)
+ if(fdatasync(fileno(fp)))
+ goto out;
+#elif defined(HAVE_FSYNC)
+ if(fsync(fileno(fp)))
+ goto out;
+#else
+ sync();
+#endif
+
if(fclose(fp)) {
fp = NULL;
goto out;