linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0154-tc-m_xt-Get-rid-of-iargc-variable-in-parse_ipt.patch

4aca6e
From cae38feb629c7d30c53366e5b48e96b759b7963d Mon Sep 17 00:00:00 2001
4aca6e
From: Phil Sutter <psutter@redhat.com>
4aca6e
Date: Tue, 4 Apr 2017 16:23:42 +0200
4aca6e
Subject: [PATCH] tc: m_xt: Get rid of iargc variable in parse_ipt()
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726
4aca6e
Upstream Status: iproute2.git commit 28432f370e6ad
4aca6e
4aca6e
commit 28432f370e6ad72a7eab9ba6bae67eabdd4b1c57
4aca6e
Author: Phil Sutter <phil@nwl.cc>
4aca6e
Date:   Fri Jun 10 13:42:06 2016 +0200
4aca6e
4aca6e
    tc: m_xt: Get rid of iargc variable in parse_ipt()
4aca6e
4aca6e
    After dropping the unused decrement of argc in the function's tail, it
4aca6e
    can fully take over what iargc has been used for.
4aca6e
4aca6e
    Signed-off-by: Phil Sutter <phil@nwl.cc>
4aca6e
---
4aca6e
 tc/m_xt.c | 9 ++++-----
4aca6e
 1 file changed, 4 insertions(+), 5 deletions(-)
4aca6e
4aca6e
diff --git a/tc/m_xt.c b/tc/m_xt.c
4aca6e
index 7947e5a..e0ed8a4 100644
4aca6e
--- a/tc/m_xt.c
4aca6e
+++ b/tc/m_xt.c
4aca6e
@@ -124,7 +124,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 
4aca6e
 	int c;
4aca6e
 	char **argv = *argv_p;
4aca6e
-	int argc = 0, iargc = 0;
4aca6e
+	int argc = 0;
4aca6e
 	char k[16];
4aca6e
 	int size = 0;
4aca6e
 	int iok = 0, ok = 0;
4aca6e
@@ -144,7 +144,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 				break;
4aca6e
 			}
4aca6e
 		}
4aca6e
-		iargc = argc = i;
4aca6e
+		argc = i;
4aca6e
 	}
4aca6e
 
4aca6e
 	if (argc <= 2) {
4aca6e
@@ -205,7 +205,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 		}
4aca6e
 	}
4aca6e
 
4aca6e
-	if (iargc > optind) {
4aca6e
+	if (argc > optind) {
4aca6e
 		if (matches(argv[optind], "index") == 0) {
4aca6e
 			if (get_u32(&index, argv[optind + 1], 10)) {
4aca6e
 				fprintf(stderr, "Illegal \"index\"\n");
4aca6e
@@ -270,9 +270,8 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 		addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
4aca6e
 	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
4aca6e
 
4aca6e
-	argc -= optind;
4aca6e
 	argv += optind;
4aca6e
-	*argc_p -= iargc;
4aca6e
+	*argc_p -= argc;
4aca6e
 	*argv_p = argv;
4aca6e
 
4aca6e
 	optind = 0;
4aca6e
-- 
4aca6e
1.8.3.1
4aca6e