You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2019/02/01 16:43:00 UTC
[trafficserver] branch 8.0.x updated: Fix RecConfigReadPluginDir
and clean up RecCore
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.0.x by this push:
new 89244b9 Fix RecConfigReadPluginDir and clean up RecCore
89244b9 is described below
commit 89244b917579acbe094a7d4549a0e7ee0fdd7f65
Author: Xavier Chi <ch...@gmail.com>
AuthorDate: Mon Jul 9 15:14:24 2018 -0500
Fix RecConfigReadPluginDir and clean up RecCore
(cherry picked from commit dfb9e8a5d1639f19b5cc3d1370e19a580c22f81b)
---
iocore/net/SSLConfig.cc | 2 +-
lib/records/I_RecCore.h | 3 ---
lib/records/RecCore.cc | 35 +++++++++--------------------------
3 files changed, 10 insertions(+), 30 deletions(-)
diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc
index 6f6e7a7..6fb4b66 100644
--- a/iocore/net/SSLConfig.cc
+++ b/iocore/net/SSLConfig.cc
@@ -160,7 +160,7 @@ set_paths_helper(const char *path, const char *filename, char **final_path, char
{
if (final_path) {
if (path && path[0] != '/') {
- *final_path = ats_stringdup(RecConfigReadPrefixPath(nullptr, path));
+ *final_path = ats_stringdup(Layout::get()->relative_to(Layout::get()->prefix, path));
} else if (!path || path[0] == '\0') {
*final_path = ats_stringdup(RecConfigReadConfigDir());
} else {
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index 946cf01..916df91 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -67,9 +67,6 @@ std::string RecConfigReadPluginDir();
// value, nullptr is returned.
std::string RecConfigReadConfigPath(const char *file_variable, const char *default_value = nullptr);
-// This is the same as RecConfigReadConfigPath, except it makes the paths relative to $PREFIX.
-std::string RecConfigReadPrefixPath(const char *file_variable, const char *default_value = nullptr);
-
// Return a copy of the persistent stats file. This is $RUNTIMEDIR/records.snap.
std::string RecConfigReadPersistentStatsPath();
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 687c6d9..d65ee71 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1199,7 +1199,15 @@ RecConfigReadBinDir()
std::string
RecConfigReadPluginDir()
{
- return RecConfigReadPrefixPath("proxy.config.plugin.plugin_dir");
+ char buf[PATH_NAME_MAX];
+
+ buf[0] = '\0';
+ RecGetRecordString("proxy.config.plugin.plugin_dir", buf, PATH_NAME_MAX);
+ if (strlen(buf) > 0) {
+ return Layout::get()->relative(buf);
+ } else {
+ return Layout::get()->libexecdir;
+ }
}
//-------------------------------------------------------------------------
@@ -1230,31 +1238,6 @@ RecConfigReadConfigPath(const char *file_variable, const char *default_value)
}
//-------------------------------------------------------------------------
-// RecConfigReadPrefixPath
-//-------------------------------------------------------------------------
-std::string
-RecConfigReadPrefixPath(const char *file_variable, const char *default_value)
-{
- char buf[PATH_NAME_MAX];
-
- // If the file name is in a configuration variable, look it up first ...
- if (file_variable) {
- buf[0] = '\0';
- RecGetRecordString(file_variable, buf, PATH_NAME_MAX);
- if (strlen(buf) > 0) {
- return Layout::get()->relative_to(Layout::get()->prefix, buf);
- }
- }
-
- // Otherwise take the default ...
- if (default_value) {
- return Layout::get()->relative_to(Layout::get()->prefix, default_value);
- }
-
- return {};
-}
-
-//-------------------------------------------------------------------------
// RecConfigReadPersistentStatsPath
//-------------------------------------------------------------------------
std::string