changeset c4b21516e1ea in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=c4b21516e1ea description: create file directly with correct rights instead of using chmod later
diffstat:
src/common/optparser.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r b578f71a4272 -r c4b21516e1ea src/common/optparser.py --- a/src/common/optparser.py Fri Aug 21 22:03:24 2015 +0200 +++ b/src/common/optparser.py Fri Aug 21 22:04:14 2015 +0200 @@ -104,7 +104,8 @@ (base_dir, filename) = os.path.split(self.__filename) self.__tempfile = os.path.join(base_dir, '.' + filename) try: - f = open(self.__tempfile, 'w') + f = os.fdopen(os.open(self.__tempfile, + os.O_CREAT|os.O_WRONLY|os.O_TRUNC, 0o600), 'w') except IOError as e: return str(e) try: @@ -125,7 +126,6 @@ os.rename(self.__tempfile, self.__filename) except IOError as e: return str(e) - os.chmod(self.__filename, 0o600)
def update_config(self, old_version, new_version): old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)