|
|
43df5c |
From b0c800d08b90b84d5d693d63602bcc4b43a07b6f Mon Sep 17 00:00:00 2001
|
|
|
43df5c |
From: Phil Sutter <psutter@redhat.com>
|
|
|
43df5c |
Date: Fri, 15 Mar 2019 17:50:34 +0100
|
|
|
43df5c |
Subject: [PATCH] Fix a few cases of pointless assignments
|
|
|
43df5c |
|
|
|
43df5c |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
|
|
|
43df5c |
Upstream Status: iptables commit 7e50ebabbf9c3
|
|
|
43df5c |
Conflicts: Dropped changes to non-existing nft-backend files.
|
|
|
43df5c |
|
|
|
43df5c |
commit 7e50ebabbf9c3a5eeb9511d9f32c6104b56da5cd
|
|
|
43df5c |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
43df5c |
Date: Wed Sep 19 15:17:04 2018 +0200
|
|
|
43df5c |
|
|
|
43df5c |
Fix a few cases of pointless assignments
|
|
|
43df5c |
|
|
|
43df5c |
This gets rid of a number of assignments which are either redundant or
|
|
|
43df5c |
not used afterwards.
|
|
|
43df5c |
|
|
|
43df5c |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
43df5c |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
43df5c |
|
|
|
43df5c |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
43df5c |
---
|
|
|
43df5c |
iptables/ip6tables-restore.c | 4 ++--
|
|
|
43df5c |
iptables/iptables-restore.c | 4 ++--
|
|
|
43df5c |
iptables/iptables-xml.c | 4 ++--
|
|
|
43df5c |
libxtables/xtoptions.c | 2 +-
|
|
|
43df5c |
utils/nfnl_osf.c | 13 +++++--------
|
|
|
43df5c |
5 files changed, 12 insertions(+), 15 deletions(-)
|
|
|
43df5c |
|
|
|
43df5c |
diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
|
|
|
43df5c |
index d610360a1c1ff..fdcc0cb5b2c06 100644
|
|
|
43df5c |
--- a/iptables/ip6tables-restore.c
|
|
|
43df5c |
+++ b/iptables/ip6tables-restore.c
|
|
|
43df5c |
@@ -427,7 +427,6 @@ int ip6tables_restore_main(int argc, char *argv[])
|
|
|
43df5c |
|
|
|
43df5c |
} else if (in_table) {
|
|
|
43df5c |
int a;
|
|
|
43df5c |
- char *ptr = buffer;
|
|
|
43df5c |
char *pcnt = NULL;
|
|
|
43df5c |
char *bcnt = NULL;
|
|
|
43df5c |
char *parsestart;
|
|
|
43df5c |
@@ -437,7 +436,8 @@ int ip6tables_restore_main(int argc, char *argv[])
|
|
|
43df5c |
|
|
|
43df5c |
if (buffer[0] == '[') {
|
|
|
43df5c |
/* we have counters in our input */
|
|
|
43df5c |
- ptr = strchr(buffer, ']');
|
|
|
43df5c |
+ char *ptr = strchr(buffer, ']');
|
|
|
43df5c |
+
|
|
|
43df5c |
if (!ptr)
|
|
|
43df5c |
xtables_error(PARAMETER_PROBLEM,
|
|
|
43df5c |
"Bad line %u: need ]\n",
|
|
|
43df5c |
diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c
|
|
|
43df5c |
index db77fb77b3c98..5a8c2c738bb0f 100644
|
|
|
43df5c |
--- a/iptables/iptables-restore.c
|
|
|
43df5c |
+++ b/iptables/iptables-restore.c
|
|
|
43df5c |
@@ -426,7 +426,6 @@ iptables_restore_main(int argc, char *argv[])
|
|
|
43df5c |
|
|
|
43df5c |
} else if (in_table) {
|
|
|
43df5c |
int a;
|
|
|
43df5c |
- char *ptr = buffer;
|
|
|
43df5c |
char *pcnt = NULL;
|
|
|
43df5c |
char *bcnt = NULL;
|
|
|
43df5c |
char *parsestart;
|
|
|
43df5c |
@@ -436,7 +435,8 @@ iptables_restore_main(int argc, char *argv[])
|
|
|
43df5c |
|
|
|
43df5c |
if (buffer[0] == '[') {
|
|
|
43df5c |
/* we have counters in our input */
|
|
|
43df5c |
- ptr = strchr(buffer, ']');
|
|
|
43df5c |
+ char *ptr = strchr(buffer, ']');
|
|
|
43df5c |
+
|
|
|
43df5c |
if (!ptr)
|
|
|
43df5c |
xtables_error(PARAMETER_PROBLEM,
|
|
|
43df5c |
"Bad line %u: need ]\n",
|
|
|
43df5c |
diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c
|
|
|
43df5c |
index 962844762fc4e..92a5768f86903 100644
|
|
|
43df5c |
--- a/iptables/iptables-xml.c
|
|
|
43df5c |
+++ b/iptables/iptables-xml.c
|
|
|
43df5c |
@@ -731,7 +731,6 @@ iptables_xml_main(int argc, char *argv[])
|
|
|
43df5c |
ret = 1;
|
|
|
43df5c |
} else if (curTable[0]) {
|
|
|
43df5c |
unsigned int a;
|
|
|
43df5c |
- char *ptr = buffer;
|
|
|
43df5c |
char *pcnt = NULL;
|
|
|
43df5c |
char *bcnt = NULL;
|
|
|
43df5c |
char *parsestart;
|
|
|
43df5c |
@@ -747,7 +746,8 @@ iptables_xml_main(int argc, char *argv[])
|
|
|
43df5c |
|
|
|
43df5c |
if (buffer[0] == '[') {
|
|
|
43df5c |
/* we have counters in our input */
|
|
|
43df5c |
- ptr = strchr(buffer, ']');
|
|
|
43df5c |
+ char *ptr = strchr(buffer, ']');
|
|
|
43df5c |
+
|
|
|
43df5c |
if (!ptr)
|
|
|
43df5c |
xtables_error(PARAMETER_PROBLEM,
|
|
|
43df5c |
"Bad line %u: need ]\n",
|
|
|
43df5c |
diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
|
|
|
43df5c |
index 0c63c2d372dea..1ad4cb57f5836 100644
|
|
|
43df5c |
--- a/libxtables/xtoptions.c
|
|
|
43df5c |
+++ b/libxtables/xtoptions.c
|
|
|
43df5c |
@@ -282,7 +282,7 @@ static void xtopt_mint_value_to_ptr(struct xt_option_call *cb, void **datap,
|
|
|
43df5c |
static void xtopt_parse_mint(struct xt_option_call *cb)
|
|
|
43df5c |
{
|
|
|
43df5c |
const struct xt_option_entry *entry = cb->entry;
|
|
|
43df5c |
- const char *arg = cb->arg;
|
|
|
43df5c |
+ const char *arg;
|
|
|
43df5c |
size_t esize = xtopt_esize_by_type(entry->type);
|
|
|
43df5c |
const uintmax_t lmax = xtopt_max_by_type(entry->type);
|
|
|
43df5c |
void *put = XTOPT_MKPTR(cb);
|
|
|
43df5c |
diff --git a/utils/nfnl_osf.c b/utils/nfnl_osf.c
|
|
|
43df5c |
index c67485ee698b1..0f8b35b805016 100644
|
|
|
43df5c |
--- a/utils/nfnl_osf.c
|
|
|
43df5c |
+++ b/utils/nfnl_osf.c
|
|
|
43df5c |
@@ -157,7 +157,6 @@ static void xt_osf_parse_opt(struct xt_osf_opt *opt, __u16 *optnum, char *obuf,
|
|
|
43df5c |
i = 0;
|
|
|
43df5c |
while (ptr != NULL && i < olen && *ptr != 0) {
|
|
|
43df5c |
val = 0;
|
|
|
43df5c |
- op = 0;
|
|
|
43df5c |
wc = OSF_WSS_PLAIN;
|
|
|
43df5c |
switch (obuf[i]) {
|
|
|
43df5c |
case 'N':
|
|
|
43df5c |
@@ -344,7 +343,7 @@ static int osf_load_line(char *buffer, int len, int del)
|
|
|
43df5c |
pend = xt_osf_strchr(pbeg, OSFPDEL);
|
|
|
43df5c |
if (pend) {
|
|
|
43df5c |
*pend = '\0';
|
|
|
43df5c |
- cnt = snprintf(obuf, sizeof(obuf), "%s,", pbeg);
|
|
|
43df5c |
+ snprintf(obuf, sizeof(obuf), "%s,", pbeg);
|
|
|
43df5c |
pbeg = pend + 1;
|
|
|
43df5c |
}
|
|
|
43df5c |
|
|
|
43df5c |
@@ -352,25 +351,23 @@ static int osf_load_line(char *buffer, int len, int del)
|
|
|
43df5c |
if (pend) {
|
|
|
43df5c |
*pend = '\0';
|
|
|
43df5c |
if (pbeg[0] == '@' || pbeg[0] == '*')
|
|
|
43df5c |
- cnt = snprintf(f.genre, sizeof(f.genre), "%s", pbeg + 1);
|
|
|
43df5c |
+ snprintf(f.genre, sizeof(f.genre), "%s", pbeg + 1);
|
|
|
43df5c |
else
|
|
|
43df5c |
- cnt = snprintf(f.genre, sizeof(f.genre), "%s", pbeg);
|
|
|
43df5c |
+ snprintf(f.genre, sizeof(f.genre), "%s", pbeg);
|
|
|
43df5c |
pbeg = pend + 1;
|
|
|
43df5c |
}
|
|
|
43df5c |
|
|
|
43df5c |
pend = xt_osf_strchr(pbeg, OSFPDEL);
|
|
|
43df5c |
if (pend) {
|
|
|
43df5c |
*pend = '\0';
|
|
|
43df5c |
- cnt = snprintf(f.version, sizeof(f.version), "%s", pbeg);
|
|
|
43df5c |
+ snprintf(f.version, sizeof(f.version), "%s", pbeg);
|
|
|
43df5c |
pbeg = pend + 1;
|
|
|
43df5c |
}
|
|
|
43df5c |
|
|
|
43df5c |
pend = xt_osf_strchr(pbeg, OSFPDEL);
|
|
|
43df5c |
if (pend) {
|
|
|
43df5c |
*pend = '\0';
|
|
|
43df5c |
- cnt =
|
|
|
43df5c |
- snprintf(f.subtype, sizeof(f.subtype), "%s", pbeg);
|
|
|
43df5c |
- pbeg = pend + 1;
|
|
|
43df5c |
+ snprintf(f.subtype, sizeof(f.subtype), "%s", pbeg);
|
|
|
43df5c |
}
|
|
|
43df5c |
|
|
|
43df5c |
xt_osf_parse_opt(f.opt, &f.opt_num, obuf, sizeof(obuf));
|
|
|
43df5c |
--
|
|
|
43df5c |
2.21.0
|
|
|
43df5c |
|