mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Uses pathcmp() where appropriate instead of fnmatch().
This commit is contained in:
parent
2cc948a50c
commit
a84bd62ee6
3 changed files with 7 additions and 6 deletions
7
elem.c
7
elem.c
|
|
@ -260,15 +260,12 @@ int filter_content(tommy_list* contentlist, const char* path)
|
|||
struct snapraid_content* content = i->data;
|
||||
char tmp[PATH_MAX];
|
||||
|
||||
/* FNM_PATHNAME because we are comparing full path */
|
||||
/* FNM_NOESCAPE because the pattern is also a path, surely without escape chars */
|
||||
/* FNM_CASEINSENSITIVE_FOR_WIN ignore case only in windows */
|
||||
if (fnmatch(content->content, path, FNM_PATHNAME | FNM_NOESCAPE | FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
if (pathcmp(content->content, path) == 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 | FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
if (pathcmp(tmp, path) == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
4
util.c
4
util.c
|
|
@ -660,8 +660,12 @@ int pathcmp(const char* a, const char* b)
|
|||
#ifdef _WIN32
|
||||
char ai[PATH_MAX];
|
||||
char bi[PATH_MAX];
|
||||
|
||||
/* import to convert \ to / */
|
||||
pathimport(ai, sizeof(ai), a);
|
||||
pathimport(bi, sizeof(bi), b);
|
||||
|
||||
/* case insensitive compare in Windows */
|
||||
return stricmp(ai, bi);
|
||||
#else
|
||||
return strcmp(a, b);
|
||||
|
|
|
|||
2
util.h
2
util.h
|
|
@ -336,7 +336,7 @@ void pathslash(char* dst, size_t size);
|
|||
|
||||
/**
|
||||
* Compare two paths.
|
||||
* In Windows it's case insentive.
|
||||
* In Windows it's case insentive and assumes \ equal at /.
|
||||
*/
|
||||
int pathcmp(const char* a, const char* b);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue