From fd743c2636546a903a503c9cbdbc93de71c789d9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 5 Jul 2018 10:54:31 +0200 Subject: [PATCH] guard call to stat() against ENOENT Move the implicit call to stat(2) into the ENOENT-safe block we just introduced. Found by unit testing. --- deltatar/deltatar.py | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deltatar/deltatar.py b/deltatar/deltatar.py index 161008c..03de734 100644 --- a/deltatar/deltatar.py +++ b/deltatar/deltatar.py @@ -733,14 +733,14 @@ class DeltaTar(object): # for each file to be in the backup, do: for path in self._recursive_walk_dir('.'): - # calculate stat dict for current file - statd = self._stat_dict(path) - statd['path'] = u'snapshot://' + statd['path'] - statd['volume'] = self.vol_no - - # backup file try: # backup file + # calculate stat dict for current file + statd = self._stat_dict(path) + statd['path'] = u'snapshot://' + statd['path'] + statd['volume'] = self.vol_no + + # backup file tarobj.add(path, arcname = statd['path'], recursive=False) except FileNotFoundError as exn: # file vanished since the call to access(3) above -- 1.7.1