aboutsummaryrefslogtreecommitdiff
path: root/linker/linker_utils.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2015-12-08 10:47:13 -0800
committerDimitry Ivanov <dimitry@google.com>2015-12-09 13:54:01 -0800
commit284ae3559ed909613b189b98bdc3efab94373a30 (patch)
tree7f525b5244599a2caa7692d3d179dde4bbb61fe3 /linker/linker_utils.cpp
parentdf196131f3c16f1eddb1542c7e04c675e7f1fbda (diff)
downloadbionic-284ae3559ed909613b189b98bdc3efab94373a30.tar.gz
Add permitted_when_isolated_path to linker namespaces
The permitted_when_isolated_path is a way to white-list directories not present in search-path. It is ignored for not isolated namespaces. Bug: http://b/25853516 Bug: http://b/22548808 Change-Id: Ib1538037268eea69323ea49968a34a4a1d1938a5
Diffstat (limited to 'linker/linker_utils.cpp')
-rw-r--r--linker/linker_utils.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index db43d38f8..1b0c4e4c9 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -66,9 +66,18 @@ bool file_is_in_dir(const std::string& file, const std::string& dir) {
const char* haystack = file.c_str();
size_t needle_len = strlen(needle);
- return (strncmp(haystack, needle, needle_len) == 0 &&
- haystack[needle_len] == '/' &&
- strchr(haystack + needle_len + 1, '/') == nullptr);
+ return strncmp(haystack, needle, needle_len) == 0 &&
+ haystack[needle_len] == '/' &&
+ strchr(haystack + needle_len + 1, '/') == nullptr;
+}
+
+bool file_is_under_dir(const std::string& file, const std::string& dir) {
+ const char* needle = dir.c_str();
+ const char* haystack = file.c_str();
+ size_t needle_len = strlen(needle);
+
+ return strncmp(haystack, needle, needle_len) == 0 &&
+ haystack[needle_len] == '/';
}
const char* const kZipFileSeparator = "!/";