Skip to content

Commit

Permalink
Fix bug. (#245)
Browse files Browse the repository at this point in the history
* Fix bug.

Signed-off-by: RileyW <wrllrwwrllrw@gmail.com>

* Fix bug.

Signed-off-by: RileyW <wrllrwwrllrw@gmail.com>

* Format.

Signed-off-by: RileyW <wrllrwwrllrw@gmail.com>

---------

Signed-off-by: RileyW <wrllrwwrllrw@gmail.com>
  • Loading branch information
RileyWen authored Mar 26, 2024
1 parent ea356f8 commit e8008d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/CraneCtld/CraneCtld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ void ParseConfig(int argc, char** argv) {
YAML::Node config = YAML::LoadFile(config_path);

if (config["CraneBaseDir"])
g_config.CraneBaseDir = config["CranedBaseDir"].as<std::string>();
g_config.CraneBaseDir = config["CraneBaseDir"].as<std::string>();
else
g_config.CraneBaseDir = kDefaultCraneBaseDir;

if (config["CraneCtldLogFile"])
g_config.CraneCtldLogFile =
g_config.CraneBaseDir +
config["CraneCtldLogFile"].as<std::string>();
else
g_config.CraneCtldLogFile =
Expand Down Expand Up @@ -97,13 +98,15 @@ void ParseConfig(int argc, char** argv) {

if (config["CraneCtldMutexFilePath"])
g_config.CraneCtldMutexFilePath =
g_config.CraneBaseDir +
config["CranedMutexFilePath"].as<std::string>();
else
g_config.CraneCtldMutexFilePath =
g_config.CraneBaseDir + kDefaultCraneCtldMutexFile;

if (config["CraneCtldDbPath"] && !config["CraneCtldDbPath"].IsNull())
g_config.CraneCtldDbPath = config["CraneCtldDbPath"].as<std::string>();
g_config.CraneCtldDbPath =
g_config.CraneBaseDir + config["CraneCtldDbPath"].as<std::string>();
else
g_config.CraneCtldDbPath = g_config.CraneBaseDir + kDefaultDbPath;

Expand Down
8 changes: 6 additions & 2 deletions src/Craned/Craned.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void ParseConfig(int argc, char** argv) {
g_config.CraneBaseDir = kDefaultCraneBaseDir;

if (config["CranedLogFile"])
g_config.CranedLogFile = config["CranedLogFile"].as<std::string>();
g_config.CranedLogFile =
g_config.CraneBaseDir + config["CranedLogFile"].as<std::string>();
else
g_config.CranedLogFile = g_config.CraneBaseDir + kCranedDefaultLogPath;

Expand Down Expand Up @@ -108,19 +109,22 @@ void ParseConfig(int argc, char** argv) {

if (config["CranedUnixSockPath"])
g_config.CranedUnixSockPath =
g_config.CraneBaseDir +
config["CranedUnixSockPath"].as<std::string>();
else
g_config.CranedUnixSockPath =
g_config.CraneBaseDir + kDefaultCranedUnixSockPath;

if (config["CranedScriptDir"])
g_config.CranedScriptDir = config["CranedScriptDir"].as<std::string>();
g_config.CranedScriptDir =
g_config.CraneBaseDir + config["CranedScriptDir"].as<std::string>();
else
g_config.CranedScriptDir =
g_config.CraneBaseDir + kDefaultCranedScriptDir;

if (config["CranedMutexFilePath"])
g_config.CranedMutexFilePath =
g_config.CraneBaseDir +
config["CranedMutexFilePath"].as<std::string>();
else
g_config.CranedMutexFilePath =
Expand Down
4 changes: 2 additions & 2 deletions src/Misc/Pam/PamUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ void LoadCraneConfig(pam_handle_t *pamh, int argc, const char **argv,
YAML::Node config = YAML::LoadFile(g_pam_config.CraneConfigFilePath);

if (config["CraneBaseDir"])
g_pam_config.CraneBaseDir =
config["CranedUnixSockPath"].as<std::string>();
g_pam_config.CraneBaseDir = config["CraneBaseDir"].as<std::string>();
else
g_pam_config.CraneBaseDir = kDefaultCraneBaseDir;

if (config["CranedUnixSockPath"])
g_pam_config.CranedUnixSockPath =
g_pam_config.CraneBaseDir +
config["CranedUnixSockPath"].as<std::string>();
else
g_pam_config.CranedUnixSockPath =
Expand Down

0 comments on commit e8008d9

Please sign in to comment.