diff options
author | Bryan Quigley <bryan.quigley@canonical.com> | 2018-06-14 17:08:18 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-18 17:15:36 +0100 |
commit | 575e8120525ad2c63baf48581f7a797f9a2e263c (patch) | |
tree | 78efeecc32a1cde638db640af827f1431dbbd7c6 | |
parent | 815a0eaabb70668648cf7e4ec911f325d95eef0b (diff) | |
download | sos-575e8120525ad2c63baf48581f7a797f9a2e263c.tar.gz |
[plugins] Check read access before trying to list a dir
I found a permission error when trying to copy /sys/fs/pstore when
running on LXD containers. Adding a permission check first allows
it to skip folders it can't list.
Resolves: #1348
Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index d6915cc3..03b060db 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -431,7 +431,7 @@ class Plugin(object): self._copy_symlink(srcpath) return else: - if stat.S_ISDIR(st.st_mode): + if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK): self._copy_dir(srcpath) return |