You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ge...@apache.org on 2010/02/04 03:30:55 UTC

svn commit: r906325 - in /incubator/trafficserver/traffic/branches/dev: ./ install/ iocore/cache/ iocore/hostdb/ librecords/ proxy/ proxy/config/ proxy/logging/ proxy/mgmt2/ proxy/mgmt2/api2/ proxy/mgmt2/api2/include/ proxy/mgmt2/api2/remote/ proxy/mgm...

Author: georgep
Date: Thu Feb  4 02:30:53 2010
New Revision: 906325

URL: http://svn.apache.org/viewvc?rev=906325&view=rev
Log:
Merge in changes from trunk(TS-85).
Tested: ubuntu904

Modified:
    incubator/trafficserver/traffic/branches/dev/   (props changed)
    incubator/trafficserver/traffic/branches/dev/install/trafficserver.in
    incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
    incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
    incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc
    incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc
    incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/Main.h
    incubator/trafficserver/traffic/branches/dev/proxy/Makefile.am
    incubator/trafficserver/traffic/branches/dev/proxy/Prefetch.cc
    incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc
    incubator/trafficserver/traffic/branches/dev/proxy/config/records.config.in
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/CoreAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/INKMgmtAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/Makefile.am
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/CoreAPIRemote.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/Makefile.am
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/NetworkUtilsRemote.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/UtilCmds.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/Makefile.am
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/TimeConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/sac.cc

Propchange: incubator/trafficserver/traffic/branches/dev/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb  4 02:30:53 2010
@@ -1 +1 @@
-/incubator/trafficserver/traffic/trunk:891822-906286
+/incubator/trafficserver/traffic/trunk:891822-906323

Modified: incubator/trafficserver/traffic/branches/dev/install/trafficserver.in
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/install/trafficserver.in?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/install/trafficserver.in (original)
+++ incubator/trafficserver/traffic/branches/dev/install/trafficserver.in Thu Feb  4 02:30:53 2010
@@ -56,13 +56,23 @@
 
 # /usr/bin/lsb_release -rd # Ubuntu release & description info
 
+HEAD=/usr/bin/head
+[ -x $HEAD ] || HEAD=head
+
 # Ubuntu: Do NOT "set -e"
 
 #Ubuntu:PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 DESC="start/stop Traffic Server"
 NAME=trafficserver
-TS_ROOT=${TS_ROOT:-@prefix@}
+
+if [ -f @prefix@/etc/traffic_server ]; then
+  TS_PREFIX=`${HEAD} -1 @prefix@/etc/traffic_server`
+else
+  TS_PREFIX="@prefix@"
+fi
+
+TS_ROOT=${TS_ROOT:-$TS_PREFIX}
 TC_NAME=${TS_NAME:-traffic_cop}
 TM_NAME=${TS_NAME:-traffic_manager}
 TS_NAME=${TS_NAME:-traffic_server}
@@ -91,9 +101,10 @@
 fi
 
 
-# Exit if the package is not installed
+# Exit if the package can not be found
 if [ ! -x "$TS_DAEMON" ]; then
-    echo "$TS_DAEMON is not installed"
+    echo "Error: Can not find $TS_DAEMON using TS_ROOT=$TS_ROOT"
+    echo "       Please set TS_ROOT to point to base installation."
     exit 0
 fi 
 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc Thu Feb  4 02:30:53 2010
@@ -2841,7 +2841,7 @@
   IOCORE_ReadConfigString(cache_system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
   Debug("cache_init", "proxy.config.config_dir = \"%s\"", cache_system_config_directory);
   if ((ierr = stat(cache_system_config_directory, &s)) < 0) {
-    ink_strncpy(cache_system_config_directory,system_config_directory,PATH_NAME_MAX); 
+    ink_strncpy(cache_system_config_directory,system_config_directory,sizeof(cache_system_config_directory)); 
     if ((ierr = stat(cache_system_config_directory, &s)) < 0) {
       // Try 'system_root_dir/etc/trafficserver' directory
       snprintf(cache_system_config_directory, sizeof(cache_system_config_directory), 

Modified: incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc Thu Feb  4 02:30:53 2010
@@ -330,7 +330,7 @@
       szPath[i] = '\\';
     i++;
   }
-  ink_strncpy(storage_path, system_root_dir, PATH_NAME_MAX);
+  ink_strncpy(storage_path, system_root_dir, sizeof(storage_path));
   strcat(storage_path, DIR_SEP);
   strcat(storage_path, szPath);
 #else
@@ -341,7 +341,7 @@
   struct stat s;
   int err;
   if ((err = stat(storage_path, &s)) < 0) {
-    ink_strncpy(storage_path,system_local_state_dir,PATH_NAME_MAX); 
+    ink_strncpy(storage_path,system_local_state_dir,sizeof(storage_path)); 
     if ((err = stat(storage_path, &s)) < 0) {
       Warning("Unable to stat() directory '%s': %d %d, %s", storage_path, err, errno, strerror(errno));
       Warning(" Please set 'proxy.config.hostdb.storage_path' or 'proxy.config.local_state_dir' ");

Modified: incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc Thu Feb  4 02:30:53 2010
@@ -122,7 +122,7 @@
   nominal_elements = aelements;
   buckets = abuckets;
   strncpy(filename, afilename, PATH_NAME_MAX - 1);
-
+  filename[PATH_NAME_MAX - 1] = '\0';
   //
   //  Allocate level 2 as the outermost
   //

Modified: incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc Thu Feb  4 02:30:53 2010
@@ -774,6 +774,7 @@
     case RECD_STRING:
       if (r->data_default.rec_string) {
         strncpy(*buf, r->data_default.rec_string, 1023);
+        buf[1023] = '\0';
       } else {
         xfree(*buf);
         *buf = NULL;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.cc Thu Feb  4 02:30:53 2010
@@ -427,7 +427,7 @@
 
 
   if ((err = stat(system_config_directory, &s)) < 0) {
-    ink_strncpy(system_config_directory,management_directory,PATH_NAME_MAX); 
+    ink_strncpy(system_config_directory,management_directory,sizeof(system_config_directory)); 
     if ((err = stat(system_config_directory, &s)) < 0) {
       REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
       if ((err = stat(system_config_directory, &s)) < 0) {
@@ -1523,9 +1523,9 @@
   int i = 0;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    strncpy(system_root_dir, env_path, PATH_NAME_MAX);
+    ink_strncpy(system_root_dir, env_path, sizeof(system_root_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) != NULL) {
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
       fclose(ts_file);
       while (!isspace(buffer[i])) {
@@ -1534,7 +1534,7 @@
       }
       system_root_dir[i] = '\0';
     } else {
-      ink_strncpy(system_root_dir, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(system_root_dir, PREFIX, sizeof(system_root_dir));
     }
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.h Thu Feb  4 02:30:53 2010
@@ -46,10 +46,12 @@
 
 #define ET_CACHE ET_CALL
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 //
 // Global Data

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Makefile.am?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Makefile.am (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Makefile.am Thu Feb  4 02:30:53 2010
@@ -396,3 +396,9 @@
 
 uninstall-local:
 	-rm -rf $(DESTDIR)$(pkglocalstatedir) $(DESTDIR)$(pkglogdir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkglibexecdir)
+
+install-exec-hook:
+	-echo $(DESTDIR)$(prefix) > $(DESTDIR)$(prefix)/etc/traffic_server
+
+uninstall-hook:
+	-rm -f $(DESTDIR)$(prefix)/etc/traffic_server

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Prefetch.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Prefetch.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Prefetch.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Prefetch.cc Thu Feb  4 02:30:53 2010
@@ -1012,7 +1012,7 @@
 
     char ip_buf[16];
     strncpy(ip_buf, ip_str, ip_len);
-    ip_buf[ip_len] = 0;
+    ip_buf[ip_len] = '\0';
 
     entry->child_ip = inet_addr(ip_buf);
   } else

Modified: incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc Thu Feb  4 02:30:53 2010
@@ -613,7 +613,7 @@
   // Jira TS-21
   REC_ReadConfigString(local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
   if ((err = stat(local_state_dir, &s)) < 0) {
-    ink_strncpy(local_state_dir,system_local_state_dir,PATH_NAME_MAX); 
+    ink_strncpy(local_state_dir,system_local_state_dir,sizeof(local_state_dir)); 
     if ((err = stat(local_state_dir, &s)) < 0) {
       Warning("Unable to stat() local state directory '%s': %d %d, %s", local_state_dir, err, errno, strerror(errno));
       Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");

Modified: incubator/trafficserver/traffic/branches/dev/proxy/config/records.config.in
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/config/records.config.in?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/config/records.config.in (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/config/records.config.in Thu Feb  4 02:30:53 2010
@@ -56,7 +56,7 @@
 CONFIG proxy.config.cluster.mc_group_addr STRING 224.0.1.37
 CONFIG proxy.config.cluster.mc_ttl INT 1
 CONFIG proxy.config.cluster.log_bogus_mc_msgs INT 1
-CONFIG proxy.config.admin.html_doc_root STRING @prefix@/share/@PACKAGE@
+CONFIG proxy.config.admin.html_doc_root STRING share/@PACKAGE@
 CONFIG proxy.config.admin.web_interface_port INT 8081
 CONFIG proxy.config.admin.autoconf_port INT 8083
 CONFIG proxy.config.admin.overseer_port INT 9898

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc Thu Feb  4 02:30:53 2010
@@ -41,10 +41,12 @@
 #include "MgmtUtils.h"
 #include "RecordsConfig.h"
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 #define LOG_ReadConfigString REC_ReadConfigString
 
@@ -337,7 +339,7 @@
 }
 
 int
-get_ts_directory(char *ts_path)
+get_ts_directory(char *ts_path, size_t ts_path_len)
 {
   FILE *fp;
   char *env_path;
@@ -345,12 +347,12 @@
   int err;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    ink_strncpy(ts_path, env_path, PATH_NAME_MAX);
+    ink_strncpy(ts_path, env_path, ts_path_len);
   } else {
-    if ((fp = fopen("/etc/traffic_server", "r")) != NULL) {
-      if (fgets(ts_path, PATH_NAME_MAX, fp) == NULL) {
+    if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
+      if (fgets(ts_path, ts_path_len, fp) == NULL) {
         fclose(fp);
-        fprintf(stderr,"\nInvalid contents in /etc/traffic_server\n");
+        fprintf(stderr,"\nInvalid contents in %s\n",DEFAULT_TS_DIRECTORY_FILE);
         fprintf(stderr," Please set correct path in env variable TS_ROOT \n");
         return -1;
       }
@@ -367,7 +369,7 @@
       
       fclose(fp);
     } else {
-      ink_strncpy(ts_path, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(ts_path, PREFIX, ts_path_len);
     }
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc Thu Feb  4 02:30:53 2010
@@ -1767,7 +1767,7 @@
   parse_errors = 0;
 
   // Get TS directory
-  if (0 == get_ts_directory(ts_path)) {
+  if (0 == get_ts_directory(ts_path,sizeof(ts_path))) {
     ink_strncpy(system_root_dir, ts_path, sizeof(system_root_dir));
     ink_snprintf(system_log_dir, sizeof(system_log_dir), "%s/var/log/trafficserver", system_root_dir);
   } else {
@@ -1783,7 +1783,7 @@
     cl.ymon = 0;
     cl.incremental = 1;
     if (cl.state_tag[0] == '\0')
-      strncpy(cl.state_tag, "ysar", 5);
+      ink_strncpy(cl.state_tag, "ysar", sizeof(cl.state_tag));
   }
   if (cl.ymon) {
     cl.ysar = 0;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc Thu Feb  4 02:30:53 2010
@@ -87,7 +87,7 @@
                "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n");
   }
   if ((err = stat(configTmp, &statBuf)) < 0) {
-    ink_strncpy(configTmp, system_config_directory,PATH_NAME_MAX); 
+    ink_strncpy(configTmp, system_config_directory,sizeof(configTmp)); 
     if ((err = stat(configTmp, &statBuf)) < 0) {
         mgmt_elog("[FileManager::FileManager] unable to stat() directory '%s': %d %d, %s\n", 
                 mgmt_path, err, errno, strerror(errno));

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc Thu Feb  4 02:30:53 2010
@@ -326,7 +326,7 @@
   }
 
   if ((err = stat(system_config_directory, &s)) < 0) {
-    ink_strncpy(system_config_directory,mgmt_path,PATH_NAME_MAX); 
+    ink_strncpy(system_config_directory,mgmt_path,sizeof(system_config_directory)); 
     if ((err = stat(system_config_directory, &s)) < 0) {
       if (use_librecords)
         REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
@@ -387,9 +387,9 @@
   int i = 0;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    strncpy(system_root_dir, env_path, PATH_NAME_MAX);
+    ink_strncpy(system_root_dir, env_path, sizeof(system_root_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) != NULL) {
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
       fclose(ts_file);
       while (!isspace(buffer[i])) {
@@ -398,7 +398,7 @@
       }
       system_root_dir[i] = '\0';
     } else {
-      ink_strncpy(system_root_dir, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(system_root_dir, PREFIX, sizeof(system_root_dir));
     }
   }
 
@@ -578,7 +578,7 @@
               exit(1);
             }
 
-            ink_strncpy(mgmt_path, argv[i], PATH_NAME_MAX);
+            ink_strncpy(mgmt_path, argv[i], sizeof(mgmt_path));
             /*
                } else if(strcmp(argv[i], "-lmConf") == 0) {
                ++i;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h Thu Feb  4 02:30:53 2010
@@ -35,10 +35,12 @@
                                   // on various OSs (linux-4096,osx/bsd-1024,
                                   //                 windows-260,etc)
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 void MgmtShutdown(int status);
 void fileUpdated(char *fname);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/CoreAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/CoreAPI.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/CoreAPI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/CoreAPI.cc Thu Feb  4 02:30:53 2010
@@ -1134,12 +1134,11 @@
   INKString tmp2;
   char *env_path;
 
-  // INST will set ROOT and INST_ROOT properly, try ROOT first
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strcnpy(ts_base_dir, env_path, 1023);
+  if ((env_path = getenv("TS_ROOT"))) {
+    ink_strncpy(ts_base_dir, env_path, sizeof(ts_base_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) == NULL) {
-      strcpy(ts_base_dir, "/home/trafficserver");
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+      ink_strncpy(ts_base_dir, "/usr/local",sizeof(ts_base_dir));
     } else {
       fgets(buffer, 1024, ts_file);
       fclose(ts_file);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/INKMgmtAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/INKMgmtAPI.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/INKMgmtAPI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/INKMgmtAPI.cc Thu Feb  4 02:30:53 2010
@@ -41,6 +41,13 @@
 
 #include "TextBuffer.h"
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 // forward declarations
 void init_pdss_format(INKPdSsFormat * info);
 
@@ -3138,12 +3145,11 @@
   INKString tmp2;
   char *env_path;
 
-  // INST will set ROOT and INST_ROOT properly, try ROOT first
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strncpy(ts_base_dir, env_path, 1023);
+  if ((env_path = getenv("TS_ROOT"))) {
+    ink_strncpy(ts_base_dir, env_path, sizeof(ts_base_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) == NULL) {
-      ink_strncpy(ts_base_dir, "/home/trafficserver", sizeof(ts_base_dir));
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+      ink_strncpy(ts_base_dir, "/usr/local", sizeof(ts_base_dir));
     } else {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
       fclose(ts_file);
@@ -3514,18 +3520,17 @@
   FILE *fp;
   char *env_path;
 
-  // INST will set ROOT and INST_ROOT properly, try ROOT first
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
+  if ((env_path = getenv("TS_ROOT"))) {
     ink_strncpy(ts_path, env_path, ts_path_len);
     return 0;
   }
 
-  if ((fp = fopen("/etc/traffic_server", "r")) == NULL) {
-    ink_strncpy(ts_path, "/home/trafficserver", ts_path_len);
+  if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+    ink_strncpy(ts_path, "/usr/local", ts_path_len);
     return 0;
   }
 
-  if (fgets(ts_path, 256, fp) == NULL) {
+  if (fgets(ts_path, ts_path_len, fp) == NULL) {
     fclose(fp);
     return INK_ERR_READ_FILE;
   }

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/Makefile.am?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/Makefile.am (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/Makefile.am Thu Feb  4 02:30:53 2010
@@ -32,7 +32,12 @@
   -I$(top_srcdir)/proxy/iocore \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/mgmt2/api2/include \
-  -I$(top_srcdir)/proxy/mgmt2/api2
+  -I$(top_srcdir)/proxy/mgmt2/api2 \
+  -DPREFIX=\"$(prefix)\" \
+  -DPKGLIBEXECDIR=\"$(pkglibexecdir)\" \
+  -DPKGLOCALSTATEDIR=\"$(pkglocalstatedir)\" \
+  -DPKGLOGDIR=\"$(pkglogdir)\" \
+  -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
 
 MGMT_DEFS = @MGMT_DEFS@
 DEFS += $(MGMT_DEFS)

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/include/INKMgmtAPI.h Thu Feb  4 02:30:53 2010
@@ -78,7 +78,6 @@
 #define NULL 0
 #endif
 
-
 #ifdef __cplusplus
 extern "C"
 {
@@ -1233,7 +1232,7 @@
  *       mgmt plugins should be specified in the records.config variable 
  *       "proxy.config.plugin.plugin_mgmt_dir" (if this directory is a relative
  *       pathname then, it is assumed that it is relative to the root directory
- *       stored in "/etc/traffic_server"). The default value is "conf/yts/plugins_mgmt",
+ *       stored in DEFAULT_TS_DIRECTORY_FILE). The default value is "conf/yts/plugins_mgmt",
  *       which tells Traffic Manager to use the directory plugins_mgmt located in the
  *       same directory as records.config. You should place your shared library (*.so)
  *       into the directory you have specified. 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/CoreAPIRemote.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/CoreAPIRemote.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/CoreAPIRemote.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/CoreAPIRemote.cc Thu Feb  4 02:30:53 2010
@@ -38,6 +38,7 @@
 
 #include <strings.h>
 #include "ink_snprintf.h"
+#include "ink_string.h"
 #include "ParseRules.h"
 #include "CoreAPI.h"
 #include "CoreAPIShared.h"
@@ -47,6 +48,13 @@
 #include "EventRegistration.h"
 #include "EventCallback.h"
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 // extern variables 
 extern CallbackTable *remote_event_callbacks;   // from EventRegistration
 extern int main_socket_fd;      // from NetworkUtils
@@ -227,8 +235,8 @@
 /*-------------------------------------------------------------------------
  * get_root_dir
  *-------------------------------------------------------------------------
- * This function retrieves the root directory path from /etc/traffic_server 
- * file. If there is no /etc/traffic_server file to be found, returns NULL 
+ * This function retrieves the root directory path from DEFAULT_TS_DIRECTORY_FILE
+ * file. If there is no DEFAULT_TS_DIRECTORY_FILE file to be found, returns NULL 
  * (copied from TrafficCop.cc). The string returned is NOT ALLOCATED. 
  * Used by HardRestart to determine full path of start/stop_traffic_server scripts.
  */
@@ -245,12 +253,12 @@
 
   bzero(root_dir, 1024);
 
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strncpy(root_dir, env_path, 1023);
+  if ((env_path = getenv("TS_ROOT"))) {
+    ink_strncpy(root_dir, env_path, sizeof(root_dir));
     return root_dir;
   }
 
-  if ((ts_file = fopen("/etc/traffic_server", "r")) != NULL) {
+  if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
     NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
     fclose(ts_file);
     while (!ParseRules::is_space(buffer[i])) {
@@ -259,7 +267,7 @@
     }
     root_dir[i] = '\0';
   } else {
-    strncpy(root_dir, "/home/trafficserver", sizeof(root_dir));
+    ink_strncpy(root_dir, "/usr/local", sizeof(root_dir));
   }
 
   if (root_dir[0] == '\0')

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/Makefile.am?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/Makefile.am (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/Makefile.am Thu Feb  4 02:30:53 2010
@@ -28,7 +28,12 @@
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/mgmt2/api2 \
   -I$(top_srcdir)/proxy/mgmt2/api2/remote \
-  -I$(top_srcdir)/proxy/mgmt2/api2/include
+  -I$(top_srcdir)/proxy/mgmt2/api2/include \
+  -DPREFIX=\"$(prefix)\" \
+  -DPKGLIBEXECDIR=\"$(pkglibexecdir)\" \
+  -DPKGLOCALSTATEDIR=\"$(pkglocalstatedir)\" \
+  -DPKGLOGDIR=\"$(pkglogdir)\" \
+  -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
 
 MGMT_DEFS = @MGMT_DEFS@
 DEFS  += $(MGMT_DEFS)

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/NetworkUtilsRemote.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/NetworkUtilsRemote.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/NetworkUtilsRemote.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/api2/remote/NetworkUtilsRemote.cc Thu Feb  4 02:30:53 2010
@@ -33,7 +33,7 @@
  ***************************************************************************/
 
 #include "ink_sock.h"
-
+#include "ink_string.h"
 #include "NetworkUtilsRemote.h"
 #include "CoreAPI.h"
 #include "CoreAPIShared.h"
@@ -160,7 +160,7 @@
   // setup Unix domain socket 
   memset(&client_sock, 0, sizeof(sockaddr_un));
   client_sock.sun_family = AF_UNIX;
-  strncpy(client_sock.sun_path, main_socket_path, sizeof(client_sock.sun_path));
+  ink_strncpy(client_sock.sun_path, main_socket_path, sizeof(client_sock.sun_path));
 #if (HOST_OS == darwin) || (HOST_OS == freebsd)
   sockaddr_len = sizeof(sockaddr_un);
 #else
@@ -185,7 +185,7 @@
   // setup Unix domain socket
   memset(&client_event_sock, 0, sizeof(sockaddr_un));
   client_event_sock.sun_family = AF_UNIX;
-  strncpy(client_event_sock.sun_path, event_socket_path, sizeof(client_sock.sun_path));
+  ink_strncpy(client_event_sock.sun_path, event_socket_path, sizeof(client_sock.sun_path));
 #if (HOST_OS == darwin) || (HOST_OS == freebsd)
   sockaddr_len = sizeof(sockaddr_un);
 #else

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliMain.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliMain.cc Thu Feb  4 02:30:53 2010
@@ -365,7 +365,7 @@
   if (cli->connectToLM() != clientCLI::err_none) {
     char ts_path[PATH_NAME_MAX + 1];
     char sock_path[PATH_NAME_MAX + 1];
-    if (0 == cli->GetTSDirectory(ts_path)) {
+    if (0 == cli->GetTSDirectory(ts_path, sizeof(ts_path))) {
       ink_snprintf(sock_path, sizeof(sock_path), "%s/var/trafficserver/cli", ts_path);
     } else {
       ink_strncpy(sock_path, clientCLI::defaultSockPath, sizeof(sock_path));

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.cc Thu Feb  4 02:30:53 2010
@@ -32,6 +32,7 @@
 #include "ink_unused.h"        /* MAGIC_EDITING_TAG */
 #include "inktomi++.h"
 #include "CliUtils.h"
+#include "clientCLI.h"
 #include "MgmtSocket.h"
 
 // These functions are stolen from MgmtUtils.cc  I hate copying them since
@@ -297,10 +298,10 @@
 
 /*
  This function is copied from cli2/CliMgmtUtils.cc. Gets the install directory from
-/etc/traffic_server
+DEFAULT_TS_DIRECTORY_FILE
 */
 int
-GetTSDirectory(char *ts_path)
+GetTSDirectory(char *ts_path, size_t ts_path_len)
 {
   FILE *fp;
   const char *env_path;
@@ -308,12 +309,12 @@
   int err;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    ink_strncpy(ts_path, env_path, PATH_NAME_MAX);
+    ink_strncpy(ts_path, env_path, ts_path_len);
   } else {
-    if ((fp = fopen("/etc/traffic_server", "r")) != NULL) {
-      if (fgets(ts_path, PATH_NAME_MAX, fp) == NULL) {
+    if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
+      if (fgets(ts_path, ts_path_len, fp) == NULL) {
         fclose(fp);
-        printf("\nInvalid contents in /etc/traffic_server\n");
+        printf("\nInvalid contents in %s\n",DEFAULT_TS_DIRECTORY_FILE);
         printf(" Please set correct path in env variable TS_ROOT \n");
         return -1;
       }
@@ -330,7 +331,7 @@
       
       fclose(fp);
     } else {
-      ink_strncpy(ts_path, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(ts_path, PREFIX, ts_path_len);
     }
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/CliUtils.h Thu Feb  4 02:30:53 2010
@@ -46,6 +46,6 @@
 // Client side functions (non-blocking I/O)
 int cli_read_timeout(int fd, char *buf, int maxlen, ink_hrtime timeout);
 int cli_write_timeout(int fd, const char *data, int nbytes, ink_hrtime timeout);
-int GetTSDirectory(char *ts_path);
+int GetTSDirectory(char *ts_path, size_t ts_path_len);
 
 #endif /* _CLI_UTILS_H_ */

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc Thu Feb  4 02:30:53 2010
@@ -75,7 +75,7 @@
 
 #ifndef _WIN32
 int
-clientCLI::GetTSDirectory(char *ts_path)
+clientCLI::GetTSDirectory(char *ts_path, size_t ts_path_len)
 {
   FILE *fp;
   char *env_path;
@@ -84,12 +84,12 @@
   int err;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    ink_strncpy(ts_path, env_path, PATH_NAME_MAX);
+    ink_strncpy(ts_path, env_path, ts_path_len);
   } else {
-    if ((fp = fopen("/etc/traffic_server", "r")) != NULL) {
-      if (fgets(ts_path, PATH_NAME_MAX, fp) == NULL) {
+    if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
+      if (fgets(ts_path, ts_path_len, fp) == NULL) {
         fclose(fp);
-        fprintf(stderr,"\nInvalid contents in /etc/traffic_server\n");
+        fprintf(stderr,"\nInvalid contents in %s\n",DEFAULT_TS_DIRECTORY_FILE);
         fprintf(stderr," Please set correct path in env variable TS_ROOT \n");
         return -1;
       }
@@ -106,7 +106,7 @@
       
       fclose(fp);
     } else {
-      ink_strncpy(ts_path, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(ts_path, PREFIX, ts_path_len);
     }
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h Thu Feb  4 02:30:53 2010
@@ -35,10 +35,12 @@
 #include "ink_platform.h"
 #include "inktomi++.h"
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 class textBuffer;
 
@@ -62,7 +64,7 @@
    ~clientCLI(void);
 
 #ifndef _WIN32
-   int GetTSDirectory(char *ts_path);
+   int GetTSDirectory(char *ts_path, size_t ts_path_len);
    void setSockPath(const char *path);
 #else
   void setCliPort(int port);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.cc Thu Feb  4 02:30:53 2010
@@ -549,7 +549,7 @@
 }
 
 int
-GetTSDirectory(char *ts_path)
+GetTSDirectory(char *ts_path, size_t ts_path_len)
 {
   FILE *fp;
   char *env_path;
@@ -558,12 +558,12 @@
   int err;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    ink_strncpy(ts_path, env_path, PATH_NAME_MAX);
+    ink_strncpy(ts_path, env_path, ts_path_len);
   } else {
-    if ((fp = fopen("/etc/traffic_server", "r")) != NULL) {
-      if (fgets(ts_path, PATH_NAME_MAX, fp) == NULL) {
+    if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
+      if (fgets(ts_path, ts_path_len, fp) == NULL) {
         fclose(fp);
-        Cli_Error("\nInvalid contents in /etc/traffic_server\n");
+        Cli_Error("\nInvalid contents in %s\n",DEFAULT_TS_DIRECTORY_FILE);
         Cli_Error(" Please set correct path in env variable TS_ROOT \n");
         return -1;
       }
@@ -580,7 +580,7 @@
       
       fclose(fp);
     } else {
-      ink_strncpy(ts_path, PREFIX, PATH_NAME_MAX);
+      ink_strncpy(ts_path, PREFIX, ts_path_len);
     }
   }
 
@@ -600,7 +600,7 @@
   char ts_path[512];
   char stop_ts[1024];
 
-  if (GetTSDirectory(ts_path)) {
+  if (GetTSDirectory(ts_path,sizeof(ts_path))) {
     return CLI_ERROR;
   }
   snprintf(stop_ts, sizeof(stop_ts), "%s/bin/stop_traffic_server", ts_path);
@@ -616,7 +616,7 @@
   char ts_path[512];
   char start_ts[1024];
 
-  if (GetTSDirectory(ts_path)) {
+  if (GetTSDirectory(ts_path,sizeof(ts_path))) {
     return CLI_ERROR;
   }
   // root user should start_traffic_shell as inktomi user

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h Thu Feb  4 02:30:53 2010
@@ -35,10 +35,12 @@
                                   // on various OSs (linux-4096,osx/bsd-1024,
                                   //                 windows-260,etc)
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 #define RECORD_GET 0
 #define RECORD_SET 1
@@ -162,7 +164,7 @@
 
 int cliCheckIfEnabled(char *command);
 
-int GetTSDirectory(char *ts_path);
+int GetTSDirectory(char *ts_path, size_t ts_path_len);
 
 int StopTrafficServer();
 int StartTrafficServer();

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/UtilCmds.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/UtilCmds.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/UtilCmds.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/UtilCmds.cc Thu Feb  4 02:30:53 2010
@@ -170,7 +170,7 @@
 
   }
   char ts_path[256];
-  if (GetTSDirectory(ts_path)) {
+  if (GetTSDirectory(ts_path,sizeof(ts_path))) {
     return CLI_ERROR;
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc Thu Feb  4 02:30:53 2010
@@ -48,10 +48,10 @@
   // traffic_shell binary should use printf to display information onscreen
   CliDisplayPrintf = 1;
 
-  // initialize MgmtAPI using TS directory specified in /etc/traffic_server
-  // or DEFAULT_LOCAL_STATE_DIRECTORY if /etc/traffic_server does not exist
+  // initialize MgmtAPI using TS directory specified in DEFAULT_TS_DIRECTORY_FILE
+  // or DEFAULT_LOCAL_STATE_DIRECTORY if DEFAULT_TS_DIRECTORY_FILE does not exist
 
-  if (GetTSDirectory(ts_path)) {
+  if (GetTSDirectory(ts_path, sizeof(ts_path))) {
     status = INKInit(DEFAULT_LOCAL_STATE_DIRECTORY);
     if (status) {
       printf("INKInit %d: Failed to initialize MgmtAPI in %s\n", status, DEFAULT_LOCAL_STATE_DIRECTORY);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc Thu Feb  4 02:30:53 2010
@@ -54,10 +54,12 @@
 #define COP_WARNING  LOG_ERR
 #define COP_DEBUG    LOG_DEBUG
 
+// TODO: consolidate location of these defaults
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
 #define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
 #define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
 #define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
 
 static char root_dir[PATH_MAX];
 static char local_state_dir[PATH_MAX];
@@ -2204,7 +2206,7 @@
   // directory or the bin/ directory. In either case, there should
   // always be a conf/yts/ directory there.
   //
-  // If there is no /etc/traffic_server file to be found, we will
+  // If there is no DEFAULT_TS_DIRECTORY_FILE file to be found, we will
   // assume there is one in the current working directory.
 
   FILE *ts_file;
@@ -2219,9 +2221,9 @@
 
   root_dir[0] = '\0';
   if ((env_path = getenv("TS_ROOT"))) {
-    strncpy(root_dir, env_path, PATH_MAX);
+    strncpy(root_dir, env_path, sizeof(root_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) != NULL) {
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
       fclose(ts_file);
       while (!isspace(buffer[i])) {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/ConfigAPI.cc Thu Feb  4 02:30:53 2010
@@ -34,10 +34,18 @@
 #include <string.h>
 #include "inktomi++.h"
 #include "CoreAPI.h"
+
 #include "../utils/XmlUtils.h"
 #include "../../../libinktomi++/SimpleTokenizer.h"
 #include "../api2/include/INKMgmtAPI.h"
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 #define NETCONFIG_HOSTNAME  0
 #define NETCONFIG_GATEWAY   1
 #define NETCONFIG_DOMAIN    2
@@ -1421,11 +1429,11 @@
   // NOTE - this script is system specific, thus if you use this funciton not under LINUX, you need to provide the appropriate 
   // script for the specific OS you use
 
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strncpy(ts_base_dir, env_path, 1023);
+  if ((env_path = getenv("TS_ROOT"))) {
+    ink_strncpy(ts_base_dir, env_path, sizeof(ts_base_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) == NULL) {
-      ink_strncpy(ts_base_dir, "/home/trafficserver", sizeof(ts_base_dir));
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+      ink_strncpy(ts_base_dir, "/usr/local", sizeof(ts_base_dir));
     } else {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
       fclose(ts_file);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/Makefile.am?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/Makefile.am (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/Makefile.am Thu Feb  4 02:30:53 2010
@@ -23,7 +23,12 @@
   -I$(top_srcdir)/proxy/mgmt2/utils \
   -I$(top_srcdir)/proxy/mgmt2/api2 \
   -I$(top_srcdir)/proxy/mgmt2/api2/include \
-  -I$(top_srcdir)/proxy/mgmt2
+  -I$(top_srcdir)/proxy/mgmt2 \
+  -DPREFIX=\"$(prefix)\" \
+  -DPKGLIBEXECDIR=\"$(pkglibexecdir)\" \
+  -DPKGLOCALSTATEDIR=\"$(pkglocalstatedir)\" \
+  -DPKGLOGDIR=\"$(pkglogdir)\" \
+  -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
 
 MGMT_DEFS = @MGMT_DEFS@
 DEFS += $(MGMT_DEFS)

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/NetConfig.cc Thu Feb  4 02:30:53 2010
@@ -73,6 +73,13 @@
 
 #include "ink_bool.h"
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 #define UP_INTERFACE     0
 #define DOWN_INTERFACE   1
 #define HOSTNAME         2
@@ -1654,11 +1661,11 @@
   char rec_config[1024];
   char *tmp;
 
-  if ((tmp = getenv("ROOT")) || (tmp = getenv("INST_ROOT"))) {
+  if ((tmp = getenv("TS_ROOT"))) {
     ink_strncpy(ts_base_dir, tmp, sizeof(ts_base_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) == NULL) {
-      ink_strncpy(ts_base_dir, "/home/trafficserver", sizeof(ts_base_dir));
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+      ink_strncpy(ts_base_dir, "/usr/local", sizeof(ts_base_dir));
     } else {
       NOWARN_UNUSED_RETURN(fgets(buffer, sizeof(buffer), ts_file));
       fclose(ts_file);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/SysAPI.cc Thu Feb  4 02:30:53 2010
@@ -45,6 +45,13 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 #define NETCONFIG_HOSTNAME  0
 #define NETCONFIG_GATEWAY   1
 #define NETCONFIG_DOMAIN    2
@@ -1114,14 +1121,13 @@
   FILE *fp;
   char *env_path;
 
-  // INST will set ROOT and INST_ROOT properly, try ROOT first
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
+  if ((env_path = getenv("TS_ROOT"))) {
     ink_strncpy(ts_path, env_path, ts_path_len);
     return 0;
   }
 
-  if ((fp = fopen("/etc/traffic_server", "r")) == NULL) {
-    ink_strncpy(ts_path, "/home/trafficserver", ts_path_len);
+  if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+    ink_strncpy(ts_path, "/usr/local", ts_path_len);
     return 0;
   }
 
@@ -1428,11 +1434,11 @@
     return 1;
   }
 
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
+  if ((env_path = getenv("TS_ROOT"))) {
     ink_strncpy(ts_base_dir, env_path, sizeof(ts_base_dir));
   } else {
-    if ((ts_file = fopen("/etc/traffic_server", "r")) == NULL) {
-      ink_strncpy(ts_base_dir, "/home/trafficserver", sizeof(ts_base_dir));
+    if ((ts_file = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+      ink_strncpy(ts_base_dir, "/usr/local", sizeof(ts_base_dir));
     } else {
       NOWARN_UNUSED_RETURN(fgets(buffer, sizeof(buf), ts_file));
       fclose(ts_file);
@@ -3046,11 +3052,11 @@
   char *env_path;
 
   if ((env_path = getenv("TS_ROOT"))) {
-    ink_strncpy(ts_path, env_path, ts_path_len);
+    ink_strcnpy(ts_path, env_path, ts_path_len);
     return 0;
   }
-  if ((fp = fopen("/etc/traffic_server", "r")) == NULL) {
-    ink_strncpy(ts_path, "/home/trafficserver", ts_path_len);
+  if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+    ink_strncpy(ts_path, "/usr/local", ts_path_len);
     return 0;
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/TimeConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/TimeConfig.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/TimeConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/tools/TimeConfig.cc Thu Feb  4 02:30:53 2010
@@ -36,6 +36,13 @@
 
 #include "ink_defs.h"
 
+// TODO: consolidate location of these defaults
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "var/log/trafficserver"
+#define DEFAULT_TS_DIRECTORY_FILE         PREFIX "/etc/traffic_server"
+
 #define CHANGE_ALL 	0
 #define CHANGE_TIME 	1
 #define CHANGE_DATE 	2
@@ -70,17 +77,17 @@
   }
   buffer[0] = 0;
 
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strncpy(buffer, env_path, 1023);
+  if ((env_path = getenv("TS_ROOT"))) {
+    strncpy(buffer, env_path, sizeof(buffer) - 1);
   } else {
-    if ((fp = fopen("/etc/traffic_server", "r")) != NULL) {
+    if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) != NULL) {
       NOWARN_UNUSED_RETURN(fgets(buffer, 1024, fp));
       if (buffer[strlen(buffer) - 1] == '\n') {
         buffer[strlen(buffer) - 1] = '\0';
       }
       fclose(fp);
     } else {
-      strncpy(buffer, "/home/trafficserver", sizeof(buffer) - 1);
+      strncpy(buffer, "/usr/local", sizeof(buffer) - 1);
     }
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc Thu Feb  4 02:30:53 2010
@@ -1889,7 +1889,7 @@
                "[WebHttp::handle_submit_snapshot] Unable to find configuration directory from proxy.config.config_dir\n");
 
   if ((err = stat(config_dir, &s)) < 0) {
-    ink_strncpy(config_dir, system_config_directory,PATH_NAME_MAX); 
+    ink_strncpy(config_dir, system_config_directory,sizeof(config_dir)); 
     if ((err = stat(config_dir, &s)) < 0) {
         mgmt_elog("[WebHttp::handle_submit_snapshot] unable to stat() directory '%s': %d %d, %s\n", 
                 config_dir, err, errno, strerror(errno));
@@ -5549,17 +5549,16 @@
   FILE *fp;
   char *env_path;
 
-  // INST will set ROOT and INST_ROOT properly, try ROOT first
-  if ((env_path = getenv("ROOT")) || (env_path = getenv("INST_ROOT"))) {
-    strcnpy(ts_path, env_path, 255);
+  if ((env_path = getenv("TS_ROOT"))) {
+    ink_strncpy(ts_path, env_path, ts_path_len);
     return 0;
   }
 
-  if ((fp = fopen("/etc/traffic_server", "r")) == NULL) {
-    ink_strncpy(ts_path, "/home/trafficserver", ts_path_len);
+  if ((fp = fopen(DEFAULT_TS_DIRECTORY_FILE, "r")) == NULL) {
+    ink_strncpy(ts_path, "/usr/local", ts_path_len);
     return 0;
   }
-  if (fgets(ts_path, 256, fp) == NULL)
+  if (fgets(ts_path, ts_path_len, fp) == NULL)
     return -1;
   // strip newline if it exists
   int len = strlen(ts_path);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc Thu Feb  4 02:30:53 2010
@@ -824,27 +824,13 @@
   // INKqa09866
   // fire up interface for ts configuration through API; use absolute path from root to 
   // set up socket paths; 
-  char local_state_path[1024];
   char api_sock_path[1024];
   char event_sock_path[1024];
 
-  bzero(local_state_path, 1024);
   bzero(api_sock_path, 1024);
   bzero(event_sock_path, 1024);
-  char *local_state_dir;
-  found = (RecGetRecordString_Xmalloc("proxy.config.local_state_dir", &local_state_dir) == REC_ERR_OKAY);
-
-  if (found == true) {
-    ink_snprintf(local_state_path, sizeof(local_state_path), "%s", local_state_dir);
-    ink_snprintf(local_state_path, sizeof(local_state_path), "%s", local_state_dir);
-    xfree(local_state_dir);
-  } else {
-    mgmt_elog("please set 'proxy.config.local_state_dir'\n");
-    _exit(1);
-  }
-
-  ink_snprintf(api_sock_path, sizeof(api_sock_path), "%s%smgmtapisocket", local_state_path, DIR_SEP);
-  ink_snprintf(event_sock_path, sizeof(event_sock_path), "%s%seventapisocket", local_state_path, DIR_SEP);
+  ink_snprintf(api_sock_path, sizeof(api_sock_path), "%s%smgmtapisocket", system_local_state_dir, DIR_SEP);
+  ink_snprintf(event_sock_path, sizeof(event_sock_path), "%s%seventapisocket", system_local_state_dir, DIR_SEP);
 
   // INKqa12562: MgmtAPI sockets should be created with 775 permission
   mode_t oldmask = umask(S_IWOTH);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/sac.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/sac.cc?rev=906325&r1=906324&r2=906325&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/sac.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/sac.cc Thu Feb  4 02:30:53 2010
@@ -100,7 +100,7 @@
   process_args(argument_descriptions, n_argument_descriptions, argv);
 
   // Get TS directory
-  if (0 == get_ts_directory(ts_path)) {
+  if (0 == get_ts_directory(ts_path,sizeof(ts_path))) {
     ink_strncpy(system_root_dir, ts_path, sizeof(system_root_dir));
   }