From efa0a169344894ac922a4e4f088577f6560a232c Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 19 Aug 2019 23:15:40 +0200 Subject: 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 --- lib/fstree/gen_file_list.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3