+struct path_rule {
+ char *path;
+ enum action action;
+ struct path_rule *next;
+};
+
+static struct path_rule default_path_rules[] = {
+ { "/etc/", SC_YES },
+ { "/lib/", SC_YES },
+ { "/usr/lib/", SC_YES },
+ { "/opt/lib/", SC_YES },
+ { "/usr/share/zoneinfo/", SC_YES },
+ { "/dev/null", SC_YES },
+ { "/dev/zero", SC_YES },
+ { "/proc/meminfo", SC_YES },
+ { "/proc/self/stat", SC_YES },
+ { "/proc/self/exe", SC_YES }, // Needed by FPC 2.0.x runtime
+};
+
+static enum action
+match_path_rule(struct path_rule *r, char *path)
+{
+ char *rr = r->path;
+ while (*rr)
+ if (*rr++ != *path++)
+ {
+ if (rr[-1] == '/' && !path[-1])
+ break;
+ return SC_DEFAULT;
+ }
+ if (rr > r->path && rr[-1] != '/' && *path)
+ return SC_DEFAULT;
+ return r->action;
+}
+