From 063b436b037f0e7e1725e5bdcca9b2bb1e692fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 9 Oct 2015 20:22:22 +0200 Subject: [PATCH] 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. --- qubes-rpc/qubes-notify-updates | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qubes-rpc/qubes-notify-updates b/qubes-rpc/qubes-notify-updates index 2dd851b8..88ea6ce0 100755 --- a/qubes-rpc/qubes-notify-updates +++ b/qubes-rpc/qubes-notify-updates @@ -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() - os.chown(source_vm.dir_path + '/' + vm_files["updates_stat_file"], -1, qubes_gid) + 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,8 +82,11 @@ def main(): update_f = open(stat_file, "w") update_f.write(update_count) update_f.close() - os.chown(stat_file, -1, qubes_gid) + try: + os.chown(stat_file, -1, qubes_gid) + except OSError: + pass else: print >> sys.stderr, 'Ignoring notification of no updates' -main() +main() \ No newline at end of file