From 50834ee9f2eecdaae3a58748f599cb25ecd1d98b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 14 Apr 2012 14:03:49 +0200 Subject: [PATCH] Excludes the .tmp copy of the content file in case it's left on the disk. --- HISTORY | 2 ++ elem.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/HISTORY b/HISTORY index 8c8325c7..131f0e26 100644 --- a/HISTORY +++ b/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 ========== diff --git a/elem.c b/elem.c index b6240360..38156808 100644 --- a/elem.c +++ b/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;