linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0153-tc-m_xt-Get-rid-of-rargc-in-parse_ipt.patch

4aca6e
From 1f1f1e431f8cb9c8051f4b04ee5d6b36cc27f949 Mon Sep 17 00:00:00 2001
4aca6e
From: Phil Sutter <psutter@redhat.com>
4aca6e
Date: Tue, 4 Apr 2017 16:23:16 +0200
4aca6e
Subject: [PATCH] tc: m_xt: Get rid of rargc in parse_ipt()
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726
4aca6e
Upstream Status: iproute2.git commit ab8f52fc4ae11
4aca6e
Conflicts: Changes in replaced code due to missing upstream commit
4aca6e
           32a121cba2579 ("tc: code cleanup").
4aca6e
4aca6e
commit ab8f52fc4ae1141ff9980d24244f2d9559e47968
4aca6e
Author: Phil Sutter <phil@nwl.cc>
4aca6e
Date:   Fri Jun 10 13:42:05 2016 +0200
4aca6e
4aca6e
    tc: m_xt: Get rid of rargc in parse_ipt()
4aca6e
4aca6e
    No need to copy the passed parameter, it's changed only once right
4aca6e
    before function return.
4aca6e
4aca6e
    Signed-off-by: Phil Sutter <phil@nwl.cc>
4aca6e
---
4aca6e
 tc/m_xt.c | 8 ++++----
4aca6e
 1 file changed, 4 insertions(+), 4 deletions(-)
4aca6e
4aca6e
diff --git a/tc/m_xt.c b/tc/m_xt.c
4aca6e
index 4e660c4..7947e5a 100644
4aca6e
--- a/tc/m_xt.c
4aca6e
+++ b/tc/m_xt.c
4aca6e
@@ -123,7 +123,6 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 	struct rtattr *tail;
4aca6e
 
4aca6e
 	int c;
4aca6e
-	int rargc = *argc_p;
4aca6e
 	char **argv = *argv_p;
4aca6e
 	int argc = 0, iargc = 0;
4aca6e
 	char k[16];
4aca6e
@@ -139,7 +138,8 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 
4aca6e
 	{
4aca6e
 		int i;
4aca6e
-		for (i = 0; i < rargc; i++) {
4aca6e
+
4aca6e
+		for (i = 0; i < *argc_p; i++) {
4aca6e
 			if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) {
4aca6e
 				break;
4aca6e
 			}
4aca6e
@@ -148,7 +148,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 	}
4aca6e
 
4aca6e
 	if (argc <= 2) {
4aca6e
-		fprintf(stderr,"bad arguements to ipt %d vs %d \n", argc, rargc);
4aca6e
+		fprintf(stderr, "bad arguments to ipt %d vs %d\n", argc, *argc_p);
4aca6e
 		return -1;
4aca6e
 	}
4aca6e
 
4aca6e
@@ -272,7 +272,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
4aca6e
 
4aca6e
 	argc -= optind;
4aca6e
 	argv += optind;
4aca6e
-	*argc_p = rargc - iargc;
4aca6e
+	*argc_p -= iargc;
4aca6e
 	*argv_p = argv;
4aca6e
 
4aca6e
 	optind = 0;
4aca6e
-- 
4aca6e
1.8.3.1
4aca6e