trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrushf...@apache.org
Subject [trafficserver] branch master updated: TS-5050: The background_fetch plugin fails to check for config files relative to the config dir etc/trafficserver.
Date Wed, 16 Nov 2016 14:40:03 GMT
This is an automated email from the ASF dual-hosted git repository.

jrushford pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  4689d9c   TS-5050: The background_fetch plugin fails to check for config files
relative to the config dir etc/trafficserver.
4689d9c is described below

commit 4689d9cf9080747c0a1f983a39dfd392d0e63c7f
Author: John J. Rushford <jrushford@apache.org>
AuthorDate: Fri Nov 11 20:31:33 2016 +0000

    TS-5050: The background_fetch plugin fails to check for config files relative to the config
dir etc/trafficserver.
---
 plugins/background_fetch/configs.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/plugins/background_fetch/configs.cc b/plugins/background_fetch/configs.cc
index f6aaf11..b36f345 100644
--- a/plugins/background_fetch/configs.cc
+++ b/plugins/background_fetch/configs.cc
@@ -38,15 +38,17 @@ BgFetchConfig::readConfig(const char *config_file)
 
   TSDebug(PLUGIN_NAME, "trying to open config file in this path: %s", config_file);
 
-  file = TSfopen(config_file, "r");
+  if (*config_file == '/') {
+    snprintf(file_path, sizeof(file_path), "%s", config_file);
+  } else {
+    snprintf(file_path, sizeof(file_path), "%s/%s", TSConfigDirGet(), config_file);
+  }
+  TSDebug(PLUGIN_NAME, "Chosen config file is at: %s", file_path);
+
+  file = TSfopen(file_path, "r");
   if (nullptr == file) {
-    TSDebug(PLUGIN_NAME, "Failed to open config file %s, trying rel path", config_file);
-    snprintf(file_path, sizeof(file_path), "%s/%s", TSInstallDirGet(), config_file);
-    file = TSfopen(file_path, "r");
-    if (nullptr == file) {
-      TSError("[%s] invalid config file", PLUGIN_NAME);
-      return false;
-    }
+    TSError("[%s] invalid config file:  %s", PLUGIN_NAME, file_path);
+    return false;
   }
 
   BgFetchRule *cur = nullptr;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message