zfs_arc: bugfix: increment array index
authorMarc Fournier <marc.fournier@camptocamp.com>
Mon, 28 Jul 2014 13:12:42 +0000 (15:12 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Mon, 28 Jul 2014 13:12:42 +0000 (15:12 +0200)
also avoid recycling the previous iterator, for the sake of better code
understanding.

src/zfs_arc.c

index 168d566..b784ee3 100644 (file)
@@ -208,7 +208,7 @@ static int za_read (void)
                {
                        llentry_t *e;
                        llvalues = malloc(sizeof(long long int) * i);
-                       i = 0;
+                       int j = 0;
 
                        pnl = file_contents;
                        while (pnl != NULL)
@@ -220,9 +220,9 @@ static int za_read (void)
                                numfields = strsplit (pnl, fields, 4);
                                if (numfields == 3)
                                {
-                                       llvalues[i] = atoll (fields[2]);
+                                       llvalues[j] = atoll (fields[2]);
 
-                                       e = llentry_create (fields[0], &llvalues[i]);
+                                       e = llentry_create (fields[0], &llvalues[j]);
                                        if (e == NULL)
                                        {
                                                ERROR ("zfs_arc plugin: `llentry_create' failed.");
@@ -231,6 +231,7 @@ static int za_read (void)
                                        {
                                                llist_append (ksp, e);
                                        }
+                                       j++;
                                }
                                pnl = pnnl;
                                if (pnl != NULL)