1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-23 05:34:18 +00:00

Ignore whitespace-only or whitespace-then-comment lines from -f sysctl.conf

" " or "  # comment" would be parsed as variable name rather than skipped.
Found and fixed by "Alf" on bugs@, thanks.

New regress/sbin/sysctl spc and spc-com targets now pass with this.
"looks good" deraadt
This commit is contained in:
kn
2025-12-27 22:25:31 +00:00
parent 7e41f1fef5
commit f8debc846d

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: sysctl.c,v 1.268 2025/08/06 16:50:53 florian Exp $ */
/* $OpenBSD: sysctl.c,v 1.269 2025/12/27 22:25:31 kn Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
while (getline(&line, &sz, fp) != -1) {
lp = line + strspn(line, " \t");
line[strcspn(line, " \t\n#")] = '\0';
lp[strcspn(lp, " \t\n#")] = '\0';
if (lp[0] != '\0')
parse(line, 1);