file_manager: check for broken symlinks in "get_file_list()"

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-04-13 15:20:19 -04:00
parent dae0f05378
commit 210cae2736
1 changed files with 6 additions and 1 deletions

View File

@ -510,7 +510,10 @@ class FileManager:
# Filter out directories that have already been visted. This
# prevents infinite recrusion "followlinks" is set to True
for dname in dir_names:
st = os.stat(os.path.join(dir_path, dname))
full_path = os.path.join(dir_path, dname)
if not os.path.exists(full_path):
continue
st = os.stat(full_path)
key = (st.st_dev, st.st_ino)
if key not in visited_dirs:
visited_dirs.add(key)
@ -527,6 +530,8 @@ class FileManager:
except Exception:
logging.exception("Error processing ufp file")
continue
if not os.path.exists(full_path):
continue
fname = full_path[len(path) + 1:]
finfo = self._get_path_info(full_path)
filelist[fname] = finfo