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!");