Skip to contentSkip to conversation

Fix typo in cmd line parsing

PATCH Applied Eric Leblond 2 participants 3 messages Jul 14, 2012 – Jul 16, 2012 netfilter

lore
Share & tools
lore
#0 lore raw

cover Fix typo in cmd line parsing

Hello,

This patch fixes what looks like a typo in the command line parsing. I did not manage to find a good explanation to the current code and I thus decide to cool this little patch.

BR,
--
Eric

#1 lore raw

PATCH 1/1 Fix typo in loop.

This patch fixes a small typo in the command line parsing.

---
 src/nfacct.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/nfacct.c +4 -4
index a59366e..8407670 100644
@@ -159,9 +159,9 @@ static int nfacct_cmd_list(int argc, char *argv[])
 	int ret, i;
 
 	for (i=2; i<argc; i++) {
-		if (strncmp(argv[i], "reset", strlen(argv[2])) == 0) {
+		if (strncmp(argv[i], "reset", strlen(argv[i])) == 0) {
 			zeroctr = true;
-		} else if (strncmp(argv[i], "xml", strlen(argv[2])) == 0) {
+		} else if (strncmp(argv[i], "xml", strlen(argv[i])) == 0) {
 			xml = true;
 		} else {
 			nfacct_perror("unknown argument");
@@ -357,9 +357,9 @@ static int nfacct_cmd_get(int argc, char *argv[])
 		return -1;
 	}
 	for (i=3; i<argc; i++) {
-		if (strncmp(argv[i], "reset", strlen(argv[2])) == 0) {
+		if (strncmp(argv[i], "reset", strlen(argv[i])) == 0) {
 			zeroctr = true;
-		} else if (strncmp(argv[i], "xml", strlen(argv[2])) == 0) {
+		} else if (strncmp(argv[i], "xml", strlen(argv[i])) == 0) {
 			xml = true;
 		} else {
 			nfacct_perror("unknown argument");
Signature · 1 line
1.7.10.4
maintainer Applied
#2 lore raw
In reply to Eric Leblond
Quoted 6 lines · Eric Leblond

Hello,

This patch fixes what looks like a typo in the command line parsing. I did not manage to find a good explanation to the current code and I thus decide to cool this little patch.

Applied, thanks Eric

You've fixed: nfacct list xml reset

that allows you to atomically get and reset counters while obtaining them in XML.