git: 2ef4baaffce0 - main - libsysdecode: avoid extra commas for undecoded netlink attributes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Aug 2026 14:34:21 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2ef4baaffce0ab71491085e68fefc92eff8e715c
commit 2ef4baaffce0ab71491085e68fefc92eff8e715c
Author: Ishan Agrawal <iagrawal9990@gmail.com>
AuthorDate: 2026-08-08 06:40:20 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-08-10 14:33:32 +0000
libsysdecode: avoid extra commas for undecoded netlink attributes
Signed-off-by: Ishan Agrawal <iagrawal9990@gmail.com>
Sponsored-by: Google LLC (GSoC 2026)
Reviewed by: kp
---
lib/libsysdecode/netlink.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/libsysdecode/netlink.c b/lib/libsysdecode/netlink.c
index 56b5671b129d..2785b23cb98b 100644
--- a/lib/libsysdecode/netlink.c
+++ b/lib/libsysdecode/netlink.c
@@ -256,13 +256,14 @@ nl_decode_attrs_raw(FILE *fp, const struct nlattr *nla_head, size_t len,
fprintf(fp, "{");
NLA_FOREACH_CONST(nla, nla_head, len) {
- if (!first)
- fprintf(fp, ",");
-
s = search_decoders(ps, pslen, nla->nla_type & NLA_TYPE_MASK);
- if (s != NULL && s->cb != NULL)
- s->cb(fp, nla, s->attr_name, s->args);
+ if (s != NULL && s->cb != NULL) {
+ if (!first)
+ fprintf(fp, ",");
+
+ s->cb(fp, nla, s->attr_name, s->args);
+ }
first = false;
}