From e2d026502fe4a16ff49fd5c10f3bd945df6ceb7a Mon Sep 17 00:00:00 2001 From: lisk77 Date: Mon, 15 Sep 2025 03:24:47 +0200 Subject: [PATCH] fix(tree): check now if the tree snapshot already exists --- src/tree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tree.c b/src/tree.c index 36287d4..0a6a80e 100644 --- a/src/tree.c +++ b/src/tree.c @@ -62,6 +62,13 @@ void snapshot_tree(FileInfoBuffer* tree, char* hash) { mkdir(dir_path, 0755); snprintf(file_path, sizeof(file_path), "%s/%s", dir_path, hash+2); + if (access(file_path, F_OK) == 0) { + free(tmp); + file_info_buffer_free(files); + free(root); + return; + } + FILE* fp = fopen(file_path, "wb"); if (!fp) { perror("ERROR: cannot open path in snapshot_tree!");