Drop `if __name__ == "__main__"` from ./bin/kconfig-hardened-check
[kconfig-hardened-check.git] / kconfig_hardened_check / __init__.py
index 0502785b893b321796c6034720dad33df3b7d827..d7df1bf58908a3c1818700cc266b67aa322a162a 100644 (file)
@@ -168,8 +168,8 @@ def parse_kconfig_file(mode, parsed_options, fname):
                 option, value = line[2:].split(' ', 1)
                 assert(value == 'is not set'), \
                        f'unexpected value of disabled Kconfig option "{line}"'
-            elif line != '' and not line.startswith('#') and mode != 'json':
-                print(f'[!] WARNING: strange line in Kconfig file: "{line}"')
+            elif line != '' and not line.startswith('#'):
+                sys.exit(f'[!] ERROR: unexpected line in Kconfig file: "{line}"')
 
             if option in parsed_options:
                 sys.exit(f'[!] ERROR: Kconfig option "{line}" is found multiple times')
@@ -201,7 +201,7 @@ def parse_cmdline_file(mode, parsed_options, fname):
 
 def parse_sysctl_file(mode, parsed_options, fname):
     with open(fname, 'r', encoding='utf-8') as f:
-        sysctl_pattern = re.compile("[a-zA-Z0-9\._-]+ =.*$")
+        sysctl_pattern = re.compile("[a-zA-Z0-9/\._-]+ =.*$")
         for line in f.readlines():
             line = line.strip()
             if not sysctl_pattern.match(line):