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.
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: