netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnftnl PATCH] Partially revert "rule, set_elem: remove trailing \n in userdata snprintf"
@ 2024-10-01 11:20 Phil Sutter
  2024-10-01 11:23 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Sutter @ 2024-10-01 11:20 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

This reverts the rule-facing part of commit
c759027a526ac09ce413dc88c308a4ed98b33416.

It can't be right: Rules without userdata are printed with a trailing
newline, so this commit made behaviour inconsistent.

Fixes: c759027a526ac ("rule, set_elem: remove trailing \n in userdata snprintf")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rule.c b/src/rule.c
index 811d5a213f835..51d778d095317 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -601,7 +601,7 @@ static int nftnl_rule_snprintf_default(char *buf, size_t remain,
 			SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 		}
 
-		ret = snprintf(buf + offset, remain, " }");
+		ret = snprintf(buf + offset, remain, " }\n");
 		SNPRINTF_BUFFER_SIZE(ret, remain, offset);
 
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-01 14:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 11:20 [libnftnl PATCH] Partially revert "rule, set_elem: remove trailing \n in userdata snprintf" Phil Sutter
2024-10-01 11:23 ` Pablo Neira Ayuso
2024-10-01 12:39   ` Phil Sutter
2024-10-01 12:47     ` Pablo Neira Ayuso
2024-10-01 14:05       ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).