[FIX] tools.config: do not chmod existing config files

lp bug: https://launchpad.net/bugs/519455 fixed

bzr revid: olivier@olivier-donys-macbook-pro.local-20101109220907-t2phxs26l136bhe7
This commit is contained in:
Olivier Dony 2010-11-09 23:09:07 +01:00
parent ad4f3dfc0b
commit af817028c6
1 changed files with 4 additions and 2 deletions

View File

@ -450,11 +450,13 @@ class configmanager(object):
# try to create the directories and write the file
try:
if not os.path.exists(os.path.dirname(self.rcfile)):
rc_exists = os.path.exists(self.rcfile)
if not rc_exists and not os.path.exists(os.path.dirname(self.rcfile)):
os.makedirs(os.path.dirname(self.rcfile))
try:
p.write(file(self.rcfile, 'w'))
os.chmod(self.rcfile, 0600)
if not rc_exists:
os.chmod(self.rcfile, 0600)
except IOError:
sys.stderr.write("ERROR: couldn't write the config file\n")