You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2017/11/06 18:58:21 UTC
[trafficserver] branch master updated: Fix logic for loading config
file for url_sig plugin.
This is an automated email from the ASF dual-hosted git repository.
amc 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 ecb2655 Fix logic for loading config file for url_sig plugin.
ecb2655 is described below
commit ecb2655ccdc6088c5bac8ef3d7b8e31c05595c5a
Author: Walt Karas <wk...@yahoo-inc.com>
AuthorDate: Fri Nov 3 17:12:11 2017 +0000
Fix logic for loading config file for url_sig plugin.
---
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 d9b9501..ad583c9 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
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].