updated they way tcp_info looks for its config file

Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/be460bfb
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/be460bfb
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/be460bfb

Branch: refs/heads/master
Commit: be460bfb98d418cec1737d8b48ec437c10c1211c
Parents: e551e1c
Author: Bryan Call <[email protected]>
Authored: Wed Aug 8 21:44:26 2012 -0700
Committer: Bryan Call <[email protected]>
Committed: Wed Aug 8 21:44:26 2012 -0700

----------------------------------------------------------------------
 plugins/experimental/tcp_info/tcp_info.cc |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/be460bfb/plugins/experimental/tcp_info/tcp_info.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/tcp_info/tcp_info.cc 
b/plugins/experimental/tcp_info/tcp_info.cc
index 9938b10..24aa572 100644
--- a/plugins/experimental/tcp_info/tcp_info.cc
+++ b/plugins/experimental/tcp_info/tcp_info.cc
@@ -54,22 +54,21 @@ load_config() {
   config.log_level = 1;
   config.log_file = NULL;
   
-  // get the configuration file name
+  // get the install directory
   const char* install_dir = TSInstallDirGet();
-  char *root = getenv("ROOT");
-  if (root != NULL && strcmp(install_dir, "ROOT") == 0) {
+
+  // figure out the config file and open it
+  snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, "etc", 
"tcp_info.config");
+  FILE *file = fopen(config_file, "r");
+  if (file == NULL) {
     snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, 
"conf", "tcp_info.config");
-  } else {
-    snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, "etc", 
"tcp_info.config");
+    file = fopen(config_file, "r");
   }
   TSDebug("tcp_info", "config file name: %s", config_file);
-
-  // open the config file
-  FILE *file = fopen(config_file, "r");
   assert(file != NULL);
-  char line[256];
 
   // read and parse the lines
+  char line[256];
   while (fgets(line, sizeof(line), file) != NULL) {
     char *pos = strchr(line, '=');
     *pos = '\0';

Reply via email to