Fixing issue related to writing ini files

When the file is opened with rwa+ and the update file size is smaller than the original the ini file can become corrupt.  The issue was noticed when we had comments at the top of /etc/yum/pluginconf.d/rhnplugin.conf after using the rhn_register module the file became correct.

rwa+ also make no sense as the file is only written too and why would any appending need to happen?
pull/26412/merge
Greg 8 years ago committed by Brian Coca
parent 9d95ea0832
commit 3506febbb9

@ -66,7 +66,7 @@ class RegistrationBase(object):
cfg.set('main', 'enabled', 1)
else:
cfg.set('main', 'enabled', 0)
fd = open(plugin_conf, 'rwa+')
fd = open(plugin_conf, 'w+')
cfg.write(fd)
fd.close()

Loading…
Cancel
Save