Handle the case of denied permission in the autodetect mode
authorAlexander Popov <alex.popov@linux.com>
Sat, 16 Nov 2024 13:12:17 +0000 (16:12 +0300)
committerAlexander Popov <alex.popov@linux.com>
Sat, 16 Nov 2024 13:12:17 +0000 (16:12 +0300)
kernel_hardening_checker/__init__.py

index 87b6e771d6f4c2d10b1ea910a9747f9fe4c19c44..58c3843579843e2eade2033241d4a77831703fca 100755 (executable)
@@ -38,6 +38,8 @@ def _open(file: str) -> TextIO:
         return open(file, 'rt', encoding='utf-8')
     except FileNotFoundError:
         sys.exit(f'[!] ERROR: unable to open {file}, are you sure it exists?')
+    except PermissionError:
+        sys.exit(f'[!] ERROR: unable to open {file}, permission denied')
 
 
 def detect_kconfig(version_fname: str) -> Tuple[StrOrNone, str]: