diff options
author | Brian Tarricone <brian@tarricone.org> | 2009-03-11 23:35:58 +0000 |
---|---|---|
committer | Brian Tarricone <brian@tarricone.org> | 2009-03-11 23:35:58 +0000 |
commit | 860dbf59556762f5b70e9addec918915823a520e (patch) | |
tree | 89832f81c577ee8a9df38e7620e8676d540f923a /xfconfd | |
parent | fb419473cf0f122b8ad67dd7989b6a805e47fe0c (diff) | |
download | xfconf-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.c | 15 |
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; |