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: