fixed linktable traversal

This commit is contained in:
Fufu Fang 2019-10-27 11:31:25 +00:00
parent 83f88dbe38
commit 4b2ac94fe1
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
1 changed files with 5 additions and 5 deletions

View File

@ -602,7 +602,7 @@ LinkTable *path_to_Link_LinkTable_new(const char *path)
{
Link *link = path_to_Link(path);
LinkTable *next_table = link->next_table;
if (next_table) {
if (!next_table) {
if (!CONFIG.sonic_mode) {
next_table = LinkTable_new(link->f_url);
} else {
@ -613,7 +613,8 @@ LinkTable *path_to_Link_LinkTable_new(const char *path)
}
}
}
return link->next_table;
link->next_table = next_table;
return next_table;
}
static Link *path_to_Link_recursive(char *path, LinkTable *linktbl)
@ -629,7 +630,6 @@ static Link *path_to_Link_recursive(char *path, LinkTable *linktbl)
*slash = '\0';
}
puts(path);
slash = strchr(path, '/');
if ( slash == NULL ) {
/* We cannot find another '/', we have reached the last level */
@ -670,8 +670,8 @@ static Link *path_to_Link_recursive(char *path, LinkTable *linktbl)
}
}
}
return path_to_Link_recursive(
next_path, linktbl->links[i]->next_table);
linktbl->links[i]->next_table = next_table;
return path_to_Link_recursive(next_path, next_table);
}
}
}