From: Philipp Gesang Date: Thu, 5 Jul 2018 09:57:27 +0000 (+0200) Subject: fix incorrect error handling in deltatar X-Git-Tag: v2.2~6^2 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=e76ca7e08fcd8adba1e2507e66905c100a5af0d4;p=python-delta-tar fix incorrect error handling in deltatar Account for the fact that the os library converts return values to exceptions ... It is not documented whether os.open() can ever return negative values at all. --- diff --git a/deltatar/deltatar.py b/deltatar/deltatar.py index 03de734..460d274 100644 --- a/deltatar/deltatar.py +++ b/deltatar/deltatar.py @@ -445,8 +445,12 @@ class DeltaTar(object): while queue: cur_path = queue.pop(0) - dfd = os.open (cur_path, os.O_DIRECTORY) - if dfd == -1: # it might have been removed in the meantime + try: + dfd = os.open (cur_path, os.O_DIRECTORY) + except FileNotFoundError as exn: + self.logger.warning ("failed to open entity [%s] as directory; " + "file system (error: %s); skipping" + % (cur_path, str (exn))) continue try: