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