Make sure the pluginstorage file gets truncated when writing to it (#6062)

This commit is contained in:
Joona Hoikkala
2018-06-04 11:08:40 -07:00
committed by Brad Warren
parent e2d6faa8a9
commit f19ebab441
+2 -1
View File
@@ -84,7 +84,8 @@ class PluginStorage(object):
raise errors.PluginStorageError(errmsg)
try:
with os.fdopen(os.open(self._storagepath,
os.O_WRONLY | os.O_CREAT, 0o600), 'w') as fh:
os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
0o600), 'w') as fh:
fh.write(serialized)
except IOError as e:
errmsg = "Could not write PluginStorage data to file {0} : {1}".format(