notify-updates: ignore chown error
If running as normal user, chown will fail. This isn't a problem, because the file is probably already owned by the correct user. The whole point about this chown is to give access to the file for normal user, so if the write succeeded, it isn't needed.
This commit is contained in:
parent
88b4a84cce
commit
063b436b03
@ -61,7 +61,10 @@ def main():
|
||||
update_f = open(source_vm.dir_path + '/' + vm_files["updates_stat_file"], "w")
|
||||
update_f.write(update_count)
|
||||
update_f.close()
|
||||
try:
|
||||
os.chown(source_vm.dir_path + '/' + vm_files["updates_stat_file"], -1, qubes_gid)
|
||||
except OSError:
|
||||
pass
|
||||
elif source_vm.template is not None:
|
||||
# Hint about updates availability in template
|
||||
# If template is running - it will notify about updates itself
|
||||
@ -79,7 +82,10 @@ def main():
|
||||
update_f = open(stat_file, "w")
|
||||
update_f.write(update_count)
|
||||
update_f.close()
|
||||
try:
|
||||
os.chown(stat_file, -1, qubes_gid)
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
print >> sys.stderr, 'Ignoring notification of no updates'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user