We may not always add to the array, so re-count it afterwards

This commit is contained in:
Roy Marples 2007-09-01 00:51:41 +00:00
parent a9ebc7a2af
commit c04af92cb4

View File

@ -95,7 +95,6 @@ int env_update (int argc, char **argv)
bool ld = true; bool ld = true;
char *ldent; char *ldent;
char **ldents = NULL; char **ldents = NULL;
int nents = 0;
char **config = NULL; char **config = NULL;
char *entry; char *entry;
char **mycolons = NULL; char **mycolons = NULL;
@ -287,7 +286,6 @@ int env_update (int argc, char **argv)
continue; continue;
ldents = rc_strlist_addu (ldents, file); ldents = rc_strlist_addu (ldents, file);
nents++;
} }
if (ldconfig) { if (ldconfig) {
@ -295,7 +293,12 @@ int env_update (int argc, char **argv)
if (rc_exists (LDSOCONF)) { if (rc_exists (LDSOCONF)) {
char **lines = rc_get_list (NULL, LDSOCONF); char **lines = rc_get_list (NULL, LDSOCONF);
char *line; char *line;
int nents = 0;
ld = false; ld = false;
STRLIST_FOREACH (ldents, line, i)
nents ++;
STRLIST_FOREACH (lines, line, i) STRLIST_FOREACH (lines, line, i)
if (i > nents || strcmp (line, ldents[i - 1]) != 0) if (i > nents || strcmp (line, ldents[i - 1]) != 0)
{ {