Excludes the .tmp copy of the content file in case it's left on the disk.

This commit is contained in:
Andrea Mazzoleni 2012-04-14 14:03:49 +02:00
parent 0f80a7fb98
commit 50834ee9f2
2 changed files with 8 additions and 0 deletions

View file

@ -7,6 +7,8 @@ SnapRAID HISTORY
exclusion.
* Fixed very long paths in Windows. We now always use the special '\\?' prefix
to remove the 260 chars limitation.
* Automatically excludes also the temporary copy of content file,
the one with the ".tmp" extension.
1.9 2012/3
==========

6
elem.c
View file

@ -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;