From c04af92cb48c3751d551bc5248bec41d0713603d Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Sat, 1 Sep 2007 00:51:41 +0000
Subject: We may not always add to the array, so re-count it afterwards

---
 src/env-update.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/env-update.c b/src/env-update.c
index 00feb282..909264d2 100644
--- a/src/env-update.c
+++ b/src/env-update.c
@@ -95,7 +95,6 @@ int env_update (int argc, char **argv)
 	bool ld = true;
 	char *ldent;
 	char **ldents = NULL;
-	int nents = 0;
 	char **config = NULL;
 	char *entry;
 	char **mycolons = NULL;
@@ -287,7 +286,6 @@ int env_update (int argc, char **argv)
 			continue;
 
 		ldents = rc_strlist_addu (ldents, file);
-		nents++;
 	}
 
 	if (ldconfig) {
@@ -295,7 +293,12 @@ int env_update (int argc, char **argv)
 		if (rc_exists (LDSOCONF)) {
 			char **lines = rc_get_list (NULL, LDSOCONF);
 			char *line;
+			int nents = 0;
 			ld = false;
+
+			STRLIST_FOREACH (ldents, line, i)
+				nents ++;
+
 			STRLIST_FOREACH (lines, line, i)
 				if (i > nents || strcmp (line, ldents[i - 1]) != 0)
 				{
-- 
cgit v1.2.3