mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-22 07:56:33 -05:00
Excludes the .tmp copy of the content file in case it's left on the disk.
This commit is contained in:
parent
0f80a7fb98
commit
50834ee9f2
2 changed files with 8 additions and 0 deletions
6
elem.c
6
elem.c
|
|
@ -198,12 +198,18 @@ int filter_content(tommy_list* contentlist, const char* path)
|
|||
|
||||
for(i=tommy_list_head(contentlist);i!=0;i=i->next) {
|
||||
struct snapraid_content* content = i->data;
|
||||
char tmp[PATH_MAX];
|
||||
|
||||
/* FNM_PATHNAME because we are comparing full path */
|
||||
/* FNM_NOESCAPE because we are comparing paths */
|
||||
/* using fnmatch allows to ignore case in windows */
|
||||
if (fnmatch(content->content, path, FNM_PATHNAME | FNM_NOESCAPE) == 0)
|
||||
return -1;
|
||||
|
||||
/* exclude also the ".tmp" copy used to save it */
|
||||
pathprint(tmp, sizeof(tmp), "%s.tmp", content->content);
|
||||
if (fnmatch(tmp, path, FNM_PATHNAME | FNM_NOESCAPE) == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue