sysctl: emit a newline after NULL node descriptions

Previously when printing the sysctl description (via the -d flag) we
omitted the newline if the node provided no description (i.e., NULL).
This could be observed via e.g. `sysctl -d dev`.

PR:		44034
Reviewed by:	zlei
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42112
This commit is contained in:
Ed Maste 2023-10-06 14:00:30 -04:00
parent 892654fe9b
commit 75be7e3027

View file

@ -998,8 +998,10 @@ show_info(char *name, const char *sep, int ctltype, char *fmt, int *qoid, int nl
bzero(buf, BUFSIZ);
j = sizeof(buf);
i = sysctl(qoid, nlen + 2, buf, &j, 0, 0);
if (i < 0)
if (i < 0) {
putchar('\n');
return (1);
}
fputs(buf, stdout);
return (error);
}