mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04: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
2
HISTORY
2
HISTORY
|
|
@ -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
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