1.13 tests txt mods + solaris port (FNM_LEADING_DIR)

This commit is contained in:
dockes
2010-01-05 15:00:18 +00:00
parent 7941e16d8f
commit aed54ee6ee
12 changed files with 52 additions and 40 deletions
+3
View File
@@ -143,6 +143,9 @@ void libclf_setmaxfd(int max)
closefrom_maxfd = max;
}
#ifdef sun
#include <limits.h>
#endif
int libclf_closefrom(int fd0)
{
int i, maxfd = closefrom_maxfd;
+25 -11
View File
@@ -125,20 +125,29 @@ bool FsTreeWalker::setSkippedPaths(const list<string> &paths)
*it = path_canon(*it);
return true;
}
bool FsTreeWalker::inSkippedPaths(const string& path)
bool FsTreeWalker::inSkippedPaths(const string& path, bool ckparents)
{
int fnmflags = FNM_PATHNAME;
#ifdef FNM_LEADING_DIR
if (ckparents)
fnmflags |= FNM_LEADING_DIR;
#endif
list<string>::const_iterator it;
for (it = data->skippedPaths.begin();
it != data->skippedPaths.end(); it++) {
// If we find a system where FNM_LEADING_DIR is undefined (its
// unposixy), will have to do this for all ascendant paths up
// to the topdir. We'll then have a constructor option because
// this is only useful when called externally. When used
// internally, we don't descend in skipped paths, and so don't
// need FNM_LEADING_DIR
if (fnmatch(it->c_str(), path.c_str(), FNM_PATHNAME |
FNM_LEADING_DIR) == 0)
return true;
#ifndef FNM_LEADING_DIR
if (ckparents) {
string mpath = path;
while (mpath.length() > 2) {
if (fnmatch(it->c_str(), mpath.c_str(), fnmflags) == 0)
return true;
mpath = path_getfather(mpath);
}
} else
#endif /* FNM_LEADING_DIR */
if (fnmatch(it->c_str(), path.c_str(), fnmflags) == 0) {
return true;
}
}
return false;
}
@@ -217,7 +226,12 @@ FsTreeWalker::Status FsTreeWalker::iwalk(const string &top,
continue;
}
if (!data->skippedPaths.empty()) {
if (inSkippedPaths(fn))
// We do not check the ancestors. This means that you can have
// a topdirs member under a skippedPath, to index a portion of
// an ignored area. This is the way it had always worked, but
// this was broken by 1.13.00 and the systematic use of
// FNM_LEADING_DIR
if (inSkippedPaths(fn, false))
goto skip;
}
+1 -1
View File
@@ -81,7 +81,7 @@ class FsTreeWalker {
/** Test if path/name should be skipped. This can be used independantly of
* an actual tree walk */
bool inSkippedPaths(const string& path);
bool inSkippedPaths(const string& path, bool ckparents = true);
bool inSkippedNames(const string& name);
private: