You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by mt...@apache.org on 2010/05/18 19:20:19 UTC
svn commit: r945776 - in /trafficserver/traffic/trunk:
iocore/hostdb/HostDB.cc proxy/Initialize.cc proxy/StatSystem.cc
Author: mturk
Date: Tue May 18 17:20:19 2010
New Revision: 945776
URL: http://svn.apache.org/viewvc?rev=945776&view=rev
Log:
Two more locations with hardcoded paths
Modified:
trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
trafficserver/traffic/trunk/proxy/Initialize.cc
trafficserver/traffic/trunk/proxy/StatSystem.cc
Modified: trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc?rev=945776&r1=945775&r2=945776&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc Tue May 18 17:20:19 2010
@@ -24,6 +24,7 @@
#define _HOSTDB_CC_
#include "P_HostDB.h"
+#include "I_Layout.h"
#ifndef NON_MODULAR
//char system_config_directory[512] = "etc/trafficserver";
@@ -319,10 +320,14 @@ HostDBCache::start(int flags)
#endif
IOCORE_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
+ if (storage_path[0] != '/') {
+ Layout::relative_to(storage_path, PATH_NAME_MAX,
+ system_root_dir, storage_path);
+ }
struct stat s;
int err;
if ((err = stat(storage_path, &s)) < 0) {
- ink_strncpy(storage_path,system_runtime_dir,sizeof(storage_path));
+ ink_strncpy(storage_path, system_runtime_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' ");
@@ -336,8 +341,9 @@ HostDBCache::start(int flags)
if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) {
Note("reconfiguring host database");
- char p[PATH_NAME_MAX];
- snprintf(p, sizeof(p), "%s%s%s%s%s", system_config_directory, DIR_SEP, "internal", DIR_SEP, "hostdb.config");
+ char p[PATH_NAME_MAX + 1];
+ Layout::relative_to(p, PATH_NAME_MAX,
+ system_config_directory, "internal/hostdb.config");
if (unlink(p) < 0)
Debug("hostdb", "unable to unlink %s", p);
Modified: trafficserver/traffic/trunk/proxy/Initialize.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Initialize.cc?rev=945776&r1=945775&r2=945776&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Initialize.cc (original)
+++ trafficserver/traffic/trunk/proxy/Initialize.cc Tue May 18 17:20:19 2010
@@ -97,6 +97,7 @@ init_system_settings(void)
#endif
}
+#if 0
// XXX: This is unused function
// Either remove it or implement Layout functions
void
@@ -142,6 +143,7 @@ init_system_dirs(void)
}
}
+#endif
#if (HOST_OS == linux)
#include <sys/prctl.h>
Modified: trafficserver/traffic/trunk/proxy/StatSystem.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/StatSystem.cc?rev=945776&r1=945775&r2=945776&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/StatSystem.cc (original)
+++ trafficserver/traffic/trunk/proxy/StatSystem.cc Tue May 18 17:20:19 2010
@@ -36,6 +36,7 @@
#include "StatPages.h"
#include "HTTP.h"
#include "RecordsConfig.h"
+#include "I_Layout.h"
// defines
@@ -573,13 +574,17 @@ void
initialize_all_global_stats()
{
int istat, i;
- char snap_file[PATH_NAME_MAX];
- char local_state_dir[PATH_NAME_MAX];
+ char snap_file[PATH_NAME_MAX + 1];
+ char local_state_dir[PATH_NAME_MAX + 1];
struct stat s;
int err;
// Jira TS-21
REC_ReadConfigString(local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
+ if (local_state_dir[0] != '/') {
+ // Not an absolute path
+ ink_strncpy(local_state_dir, Layout::get()->runtimedir, sizeof(local_state_dir));
+ }
if ((err = stat(local_state_dir, &s)) < 0) {
ink_strncpy(local_state_dir,system_runtime_dir,sizeof(local_state_dir));
if ((err = stat(local_state_dir, &s)) < 0) {
@@ -588,8 +593,8 @@ initialize_all_global_stats()
}
}
REC_ReadConfigString(snap_file, "proxy.config.stats.snap_file", PATH_NAME_MAX);
- snprintf(snap_filename, sizeof(snap_filename), "%s%s%s", local_state_dir,
- DIR_SEP, snap_file);
+ Layout::relative_to(snap_filename, sizeof(snap_filename),
+ local_state_dir, snap_file);
Debug("stats", "stat snap filename %s", snap_filename);
stat_callback_init();