Exclude snapshot directory only when snapshot mode is enabled

This commit is contained in:
Andrea Mazzoleni 2026-08-14 09:47:12 +02:00
parent daf713820e
commit 30417d57a5
4 changed files with 7 additions and 4 deletions

View file

@ -389,8 +389,11 @@ int filter_content(tommy_list* contentlist, const char* mount_point, size_t moun
return 0;
}
int filter_snapshot(const char* sub, const char* name)
int filter_snapshot(int enable, const char* sub, const char* name)
{
if (!enable)
return 0;
if (*sub == 0 && pathcmp(name, SNAPSHOT_CONTAINER) == 0)
return -1;

View file

@ -649,7 +649,7 @@ int filter_content(tommy_list* contentlist, const char* mount_point, size_t moun
* Filter a path that is in a snapshot
* Return !=0 if should be excluded.
*/
int filter_snapshot(const char* sub, const char* name);
int filter_snapshot(int enable, const char* sub, const char* name);
/**
* Check if the specified hash is invalid.

View file

@ -1437,7 +1437,7 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa
}
/* exclude snapshot container even before calling lstat() */
if (filter_snapshot(sub_next, name) != 0) {
if (filter_snapshot(state->snapshot, sub_next, name) != 0) {
msg_verbose("Excluding snapshots directory '%s'\n", path_next);
continue;
}

View file

@ -192,7 +192,7 @@ static void search_dir(struct snapraid_state* state, struct snapraid_disk* disk,
}
/* exclude snapshot container even before calling lstat() */
if (disk != 0 && filter_snapshot(sub, name) != 0) {
if (disk != 0 && filter_snapshot(state->snapshot, sub, name) != 0) {
msg_verbose("Excluding snapshots directory '%s'\n", path_next);
continue;
}