Blame SOURCES/0007-cli-Drop-pointless-check-in-cli_append_multiline.patch

ad45ff
From a5e89843a77c234f1f858737b676161ff8ee0227 Mon Sep 17 00:00:00 2001
ad45ff
From: Phil Sutter <psutter@redhat.com>
ad45ff
Date: Wed, 20 Jun 2018 09:22:00 +0200
ad45ff
Subject: [PATCH] cli: Drop pointless check in cli_append_multiline()
ad45ff
ad45ff
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1504157
ad45ff
Upstream Status: nftables commit f51ed1db70abd
ad45ff
Conflicts: Context change due to missing commit
ad45ff
           4c15b4008c249 ("cli: Use nft_run_cmd_from_buffer()")
ad45ff
ad45ff
commit f51ed1db70abdbb909e81bc670ffdfa05f421257
ad45ff
Author: Phil Sutter <phil@nwl.cc>
ad45ff
Date:   Thu Mar 1 15:00:27 2018 +0100
ad45ff
ad45ff
    cli: Drop pointless check in cli_append_multiline()
ad45ff
ad45ff
    The function is called from cli_complete after it has checked for line
ad45ff
    to be != NULL. The other part of the conditional, namely multiline being
ad45ff
    NULL, is perfectly valid (if the last read line didn't end with
ad45ff
    backslash. Hence drop the conditional completely.
ad45ff
ad45ff
    Since variable eof is not used anywhere outside of the dropped
ad45ff
    conditional, get rid of it completely.
ad45ff
ad45ff
    Signed-off-by: Phil Sutter <phil@nwl.cc>
ad45ff
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
ad45ff
---
ad45ff
 src/cli.c | 12 ++----------
ad45ff
 1 file changed, 2 insertions(+), 10 deletions(-)
ad45ff
ad45ff
diff --git a/src/cli.c b/src/cli.c
ad45ff
index cadc3af..53427a0 100644
ad45ff
--- a/src/cli.c
ad45ff
+++ b/src/cli.c
ad45ff
@@ -46,21 +46,13 @@ static struct mnl_socket *cli_nf_sock;
ad45ff
 static void *scanner;
ad45ff
 static char histfile[PATH_MAX];
ad45ff
 static char *multiline;
ad45ff
-static bool eof;
ad45ff
 
ad45ff
 static char *cli_append_multiline(char *line)
ad45ff
 {
ad45ff
+	size_t len = strlen(line);
ad45ff
 	bool complete = false;
ad45ff
-	size_t len;
ad45ff
 	char *s;
ad45ff
 
ad45ff
-	if (line == NULL && multiline == NULL) {
ad45ff
-		eof = true;
ad45ff
-		return NULL;
ad45ff
-	}
ad45ff
-
ad45ff
-	len = strlen(line);
ad45ff
-
ad45ff
 	if (len == 0)
ad45ff
 		return NULL;
ad45ff
 
ad45ff
@@ -174,7 +166,7 @@ int cli_init(struct nft_ctx *nft, struct mnl_socket *nf_sock,
ad45ff
 	state	= _state;
ad45ff
 	scanner = scanner_init(state);
ad45ff
 
ad45ff
-	while (!eof)
ad45ff
+	while (true)
ad45ff
 		rl_callback_read_char();
ad45ff
 	return 0;
ad45ff
 }
ad45ff
-- 
ad45ff
1.8.3.1
ad45ff