From 28e3c36944c42f93c6e82ac2009319a5fc3f9f90 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Wed, 2 Jun 2010 22:14:57 +0200 Subject: [PATCH] [Jonathan Michalon] flush and fsync config file before closing it. Fixes #5768 --- src/common/optparser.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common/optparser.py b/src/common/optparser.py index 34c92271dc..e895481636 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -115,13 +115,16 @@ class OptionsParser: gajim.config.foreach(self.write_line, f) except IOError, e: return str(e) + f.flush() + os.fsync(f.fileno()) f.close() if os.path.exists(self.__filename): - # win32 needs this - try: - os.remove(self.__filename) - except Exception: - pass + if os.name == 'nt': + # win32 needs this + try: + os.remove(self.__filename) + except Exception: + pass try: os.rename(self.__tempfile, self.__filename) except IOError, e: -- GitLab