core: prevent permissions error when VM was started by root

When VM is started by root, config file is created with root owner and
user has no write access to it. As the directory is user-writable,
delete the file first.

Conflicts:
	core-modules/000QubesVm.py
This commit is contained in:
Marek Marczykowski-Górecki 2015-01-16 04:29:18 +01:00
parent 52334bc414
commit 49d510dc65

View File

@ -1090,6 +1090,8 @@ class QubesVm(object):
# FIXME: This is only for debugging purposes
old_umask = os.umask(002)
try:
if os.path.exists(file_path):
os.unlink(file_path)
conf_appvm = open(file_path, "w")
conf_appvm.write(domain_config)
conf_appvm.close()