aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 23:15:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 23:15:40 +0200
commitefa0a169344894ac922a4e4f088577f6560a232c (patch)
tree915a7e8c3a942bad7b082469f5c1c47a7fddb134
parent3f7e23cf08560facf861e1773390d4f5b67d39cc (diff)
Fix file list generation: break any pre-existing connection
If the linked list pointer was already used before, break up the connection so we don't risk running into a loop or something when regenerating the list. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/fstree/gen_file_list.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/fstree/gen_file_list.c b/lib/fstree/gen_file_list.c
index c1cde51..6b10b00 100644
--- a/lib/fstree/gen_file_list.c
+++ b/lib/fstree/gen_file_list.c
@@ -9,8 +9,10 @@
static file_info_t *file_list_dfs(tree_node_t *n)
{
- if (S_ISREG(n->mode))
+ if (S_ISREG(n->mode)) {
+ n->data.file->next = NULL;
return n->data.file;
+ }
if (S_ISDIR(n->mode)) {
file_info_t *list = NULL, *last = NULL;