Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions mgmt/config/FileManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,29 +368,23 @@ FileManager::ConfigManager::ConfigManager(const char *fileName_, const char *con
}

// Copy the file name.
fileName = ats_strdup(fileName_);
configName = ats_strdup(configName_);
fileName = std::string(fileName_);
configName = std::string(configName_);

ink_mutex_init(&fileAccessLock);
// Check to make sure that our configuration file exists
//
if (statFile(&fileInfo) < 0) {
Debug(logTag, "%s Unable to load: %s", fileName, strerror(errno));
Debug(logTag, "%s Unable to load: %s", fileName.c_str(), strerror(errno));

if (isRequired) {
Debug(logTag, " Unable to open required configuration file %s\n\t failed :%s", fileName, strerror(errno));
Debug(logTag, " Unable to open required configuration file %s\n\t failed :%s", fileName.c_str(), strerror(errno));
}
} else {
fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
}
}

FileManager::ConfigManager::~ConfigManager()
{
ats_free(fileName);
ats_free(configName);
}

//
//
// int ConfigManager::statFile()
Expand Down Expand Up @@ -431,7 +425,7 @@ FileManager::ConfigManager::checkForUserUpdate(FileManager::RollBackCheckType ho
fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
// TODO: syslog????
}
Debug(logTag, "User has changed config file %s\n", fileName);
Debug(logTag, "User has changed config file %s\n", fileName.c_str());
result = true;
} else {
result = false;
Expand Down
9 changes: 4 additions & 5 deletions mgmt/config/FileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class FileManager
// fileName_ should be rooted or a base file name.
ConfigManager(const char *fileName_, const char *configName_, bool root_access_needed, bool isRequired_,
ConfigManager *parentConfig_);
~ConfigManager();

// Manual take out of lock required
void
Expand All @@ -73,13 +72,13 @@ class FileManager
const char *
getFileName() const
{
return fileName;
return fileName.c_str();
}

const char *
getConfigName() const
{
return configName;
return configName.c_str();
}

bool
Expand Down Expand Up @@ -114,8 +113,8 @@ class FileManager
int statFile(struct stat *buf);

ink_mutex fileAccessLock;
char *fileName;
char *configName;
std::string fileName;
std::string configName;
bool root_access_needed;
bool isRequired;
ConfigManager *parentConfig;
Expand Down