index 70d10bc3da8ae24fd594e443d6f33f9f4375f621..c3bddb60c81fbf362614f081a5b62f0160a01c63 100644 (file)
--- a/dir.c
+++ b/dir.c
return len;
}
+int within_depth(const char *name, int namelen,
+ int depth, int max_depth)
+{
+ const char *cp = name, *cpe = name + namelen;
+
+ while (cp < cpe) {
+ if (*cp++ != '/')
+ continue;
+ depth++;
+ if (depth > max_depth)
+ return 0;
+ }
+ return 1;
+}
+
/*
* Does 'match' match the given name?
* A match is found if