From ec5ba51f98f5f1384efea9d73321f203d8fcda61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarno=20Sepp=C3=A4nen?= Date: Wed, 14 May 2014 22:45:03 +0300 Subject: [PATCH] Fix potential data loss if cleaning old files fails --- gpgfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpgfs.py b/gpgfs.py index 1e1d6f5..1f9d490 100755 --- a/gpgfs.py +++ b/gpgfs.py @@ -191,8 +191,6 @@ class GpgFs(LoggingMixIn, Operations): yield putx # commit write_index(self.store, self.index_path, self.root) - if paths['old']: - self.store.delete(paths['old']) except: # rollback try: @@ -204,6 +202,8 @@ class GpgFs(LoggingMixIn, Operations): except: log.exception('rollback failed') raise + if paths['old']: + self.store.delete(paths['old']) def chmod(self, path, mode): # sanitize mode (clear setuid/gid/sticky bits)