trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dra...@apache.org
Subject [trafficserver] branch master updated: Fix RecConfigReadPluginDir and clean up RecCore
Date Tue, 10 Jul 2018 21:11:27 GMT
This is an automated email from the ASF dual-hosted git repository.

dragon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new dfb9e8a  Fix RecConfigReadPluginDir and clean up RecCore
dfb9e8a is described below

commit dfb9e8a5d1639f19b5cc3d1370e19a580c22f81b
Author: Xavier Chi <chitianhaoxp@gmail.com>
AuthorDate: Mon Jul 9 15:14:24 2018 -0500

    Fix RecConfigReadPluginDir and clean up RecCore
---
 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 c034cbc..284d951 100644
--- a/iocore/net/SSLConfig.cc
+++ b/iocore/net/SSLConfig.cc
@@ -143,7 +143,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 16bd554..d95a929 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 21851fa..ddd281b 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1190,7 +1190,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;
+  }
 }
 
 //-------------------------------------------------------------------------
@@ -1221,31 +1229,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


Mime
View raw message