with open(fname, 'r', encoding='utf-8') as f:
line = f.readline()
if not line:
- sys.exit(f'[!] ERROR: empty "{fname}"')
+ sys.exit(f'[!] ERROR: empty cmdline file "{fname}"')
opts = line.split()
sys.exit(f'[!] ERROR: unable to open {fname}, are you sure it exists?')
with open(fname, 'r', encoding='utf-8') as f:
+ if os.stat(fname).st_size == 0:
+ sys.exit(f'[!] ERROR: empty sysctl file "{fname}"')
+
sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ ?=.*$")
for line in f.readlines():
line = line.strip()