summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/container/bookmarks.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 5f163e89..cbb95864 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -156,6 +156,12 @@ class Bookmarks(object):
                         pass
 
             f.close()
+            old_perms = os.stat(self.path)
+            try:
+                os.chown(self.path+".new", old_perms.st_uid, old_perms.st_gid)
+                os.chmod(self.path+".new", old_perms.st_mode)
+            except OSError:
+                pass
             os.rename(self.path+".new", self.path)
         self._update_mtime()