diff options
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/configinterface.py | 11 | ||||
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/syncdutils.py | 3 |
2 files changed, 7 insertions, 7 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/configinterface.py b/xlators/features/marker/utils/syncdaemon/configinterface.py index a1079d803..23526861f 100644 --- a/xlators/features/marker/utils/syncdaemon/configinterface.py +++ b/xlators/features/marker/utils/syncdaemon/configinterface.py @@ -113,11 +113,11 @@ class GConffile(object): def mergeconf(f): self.config = ConfigParser.RawConfigParser() self.config.readfp(f) - def updateconf(f): if not self.config.has_section(SECT_META): self.config.add_section(SECT_META) self.config.set(SECT_META, 'version', config_version) - trfn(*a, **kw) + return trfn(*a, **kw) + def updateconf(f): self.config.write(f) syncdutils.update_file(self.path, updateconf, mergeconf) @@ -130,16 +130,15 @@ class GConffile(object): self.config.add_section(SECT_ORD) self.config.set(SECT_ORD, sect, len(self.config._sections[SECT_ORD])) self.config.set(sect, opt, val) + return True def set(self, *a, **kw): self.write(self._set, *a, **kw) def _delete(self, opt, rx=False): sect = self.section(rx) - if not self.config.has_section(sect): - return - if self.config.remove_option(sect, opt): - self.write() + if self.config.has_section(sect): + return self.config.remove_option(sect, opt) def delete(self, *a, **kw): self.write(self._delete, *a, **kw) diff --git a/xlators/features/marker/utils/syncdaemon/syncdutils.py b/xlators/features/marker/utils/syncdaemon/syncdutils.py index 5c17d0579..d3ab2f345 100644 --- a/xlators/features/marker/utils/syncdaemon/syncdutils.py +++ b/xlators/features/marker/utils/syncdaemon/syncdutils.py @@ -24,7 +24,8 @@ def update_file(path, updater, merger = lambda f: True): os.close(fd) raise fcntl.lockf(fr, fcntl.LOCK_EX) - merger(fr) + if not merger(fr): + return tmpp = path + '.tmp.' + str(os.getpid()) fd = os.open(tmpp, os.O_CREAT|os.O_EXCL|os.O_WRONLY) |