diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2023-10-06 18:00:30 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2023-10-10 02:48:53 +0000 |
| commit | 75be7e30271bb192fd27698982f2c7e56831eeef (patch) | |
| tree | c2516a575a7dd8c7bde6501dd19311b7d014c609 | |
| parent | 892654fe9b5a9115815c30a423b8db47185aebbd (diff) | |
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
| -rw-r--r-- | sbin/sysctl/sysctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index fe1a53a9d645..7ed7be95c9a5 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -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); } |
