trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 02/08: Fix logic for loading config file for url_sig plugin.
Date Mon, 12 Mar 2018 17:55:04 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 0a1408751e83e953c980471a0bdaf4af0c56fc71
Author: Walt Karas <wkaras@yahoo-inc.com>
AuthorDate: Fri Nov 3 17:12:11 2017 +0000

    Fix logic for loading config file for url_sig plugin.
    
    (cherry picked from commit ecb2655ccdc6088c5bac8ef3d7b8e31c05595c5a)
---
 plugins/experimental/url_sig/url_sig.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index 3dc0de1..9923693 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -101,7 +101,7 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
 TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_size)
 {
-  char config_file[PATH_MAX];
+  char config_filepath_buf[PATH_MAX], *config_file;
   struct config *cfg;
 
   if (argc != 3) {
@@ -111,8 +111,12 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int
errbuf_s
   }
   TSDebug(PLUGIN_NAME, "Initializing remap function of %s -> %s with config from %s",
argv[0], argv[1], argv[2]);
 
-  const char *install_dir = TSInstallDirGet();
-  snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, "etc/trafficserver",
argv[2]);
+  if (argv[2][0] == '/') {
+    config_file = argv[2];
+  } else {
+    snprintf(config_filepath_buf, sizeof(config_filepath_buf), "%s/%s", TSConfigDirGet(),
argv[2]);
+    config_file = config_filepath_buf;
+  }
   TSDebug(PLUGIN_NAME, "config file name: %s", config_file);
   FILE *file = fopen(config_file, "r");
   if (file == NULL) {

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.

Mime
View raw message