projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 2:
e77a75f
)
Merge branch 'master' into open-check
author
Alexander Popov
<alex.popov@linux.com>
Sun, 2 Jun 2024 16:38:10 +0000
(19:38 +0300)
committer
Alexander Popov
<alex.popov@linux.com>
Sun, 2 Jun 2024 16:38:10 +0000
(19:38 +0300)
kernel_hardening_checker/__init__.py
patch
|
blob
|
history
diff --git
a/kernel_hardening_checker/__init__.py
b/kernel_hardening_checker/__init__.py
index 91742c3923d78973a2d865b05adee609851c4568..614084e4e3a7ac7af704e76f4b7b2c6fd01ca4a5 100644
(file)
--- a/
kernel_hardening_checker/__init__.py
+++ b/
kernel_hardening_checker/__init__.py
@@
-26,9
+26,12
@@
__version__ = '0.6.6'
def _open(file: str) -> TextIO:
- if file.endswith('.gz'):
- return gzip.open(file, 'rt', encoding='utf-8')
- return open(file, 'rt', encoding='utf-8')
+ try:
+ if file.endswith('.gz'):
+ return gzip.open(file, 'rt', encoding='utf-8')
+ return open(file, 'rt', encoding='utf-8')
+ except FileNotFoundError:
+ sys.exit(f'[!] ERROR: unable to open {file}, are you sure it exists?')
def detect_arch(fname: str, archs: List[str]) -> Tuple[StrOrNone, str]: