[nft PATCH] cli: Drop String termination workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This spot was missed by commit 2b3f18e0cf7a7 ("libnftables: Fix for
input without trailing newline") - since line termination is now added
in nft_run_cmd_from_buffer(), cli is relieved from doing so.

Fixes: 2b3f18e0cf7a7 ("libnftables: Fix for input without trailing newline")
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 src/cli.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/cli.c b/src/cli.c
index eb60d01dad3dc..241ea0105512f 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -83,8 +83,6 @@ static void cli_complete(char *line)
 	const HIST_ENTRY *hist;
 	const char *c;
 	LIST_HEAD(msgs);
-	int len;
-	char *s;
 
 	if (line == NULL) {
 		printf("\n");
@@ -112,13 +110,7 @@ static void cli_complete(char *line)
 	if (hist == NULL || strcmp(hist->line, line))
 		add_history(line);
 
-	len = strlen(line);
-	s = xmalloc(len + 2);
-	snprintf(s, len + 2, "%s\n", line);
-	xfree(line);
-	line = s;
-
-	nft_run_cmd_from_buffer(cli_nft, line, len + 2);
+	nft_run_cmd_from_buffer(cli_nft, line, strlen(line) + 1);
 	xfree(line);
 }
 
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux