Patchwork Fix typo in loop.

login
register
mail settings
Submitter Eric Leblond
Date July 14, 2012, 9:40 p.m.
Message ID <1342302032-9108-2-git-send-email-eric@regit.org>
Download mbox | patch
Permalink /patch/171029/
State Accepted
Headers show

Comments

Eric Leblond - July 14, 2012, 9:40 p.m.
This patch fixes a small typo in the command line parsing.
---
 src/nfacct.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/src/nfacct.c b/src/nfacct.c
index a59366e..8407670 100644
--- a/src/nfacct.c
+++ b/src/nfacct.c
@@ -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");