Automatically exclude the snapshot .snapraid directory and content files

This commit is contained in:
Andrea Mazzoleni 2026-05-11 23:24:36 +02:00
parent 37ff42a1c2
commit ea470341aa
10 changed files with 111 additions and 22 deletions

View file

@ -138,6 +138,9 @@ static void search_dir(struct snapraid_state* state, struct snapraid_disk* disk,
{
DIR* d;
size_t mount_point_len = disk != 0 ? strlen(disk->mount_point) : 0;
size_t sub_len = strlen(sub);
d = opendir(dir);
if (!d) {
/* LCOV_EXCL_START */
@ -183,11 +186,17 @@ static void search_dir(struct snapraid_state* state, struct snapraid_disk* disk,
}
/* exclude content files even before calling lstat() */
if (disk != 0 && filter_content(&state->contentlist, path_next) != 0) {
if (disk != 0 && filter_content(&state->contentlist, disk->mount_point, mount_point_len, sub, sub_len, name) != 0) {
msg_verbose("Excluding content '%s'\n", path_next);
continue;
}
/* exclude snapshot container even before calling lstat() */
if (disk != 0 && filter_snapshot(sub, name) != 0) {
msg_verbose("Excluding snapshots directory '%s'\n", path_next);
continue;
}
#if HAVE_STRUCT_DIRENT_D_STAT
/* convert dirent to lstat result */
dirent_lstat(dd, &st);