mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
logs: Use correct path and more appropriate macros in cookie-related code
filepath_tmp -> filepath in last message. More material changes to nearby code in next commit.
This commit is contained in:
parent
6e28c76907
commit
e82ad88452
2 changed files with 4 additions and 4 deletions
|
@ -301,7 +301,7 @@ static bool InitRPCAuthentication()
|
||||||
if (cookie_perms_arg) {
|
if (cookie_perms_arg) {
|
||||||
auto perm_opt = InterpretPermString(*cookie_perms_arg);
|
auto perm_opt = InterpretPermString(*cookie_perms_arg);
|
||||||
if (!perm_opt) {
|
if (!perm_opt) {
|
||||||
LogInfo("Invalid -rpccookieperms=%s; must be one of 'owner', 'group', or 'all'.\n", *cookie_perms_arg);
|
LogError("Invalid -rpccookieperms=%s; must be one of 'owner', 'group', or 'all'.", *cookie_perms_arg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cookie_perms = *perm_opt;
|
cookie_perms = *perm_opt;
|
||||||
|
|
|
@ -108,7 +108,7 @@ bool GenerateAuthCookie(std::string* cookie_out, std::optional<fs::perms> cookie
|
||||||
fs::path filepath_tmp = GetAuthCookieFile(true);
|
fs::path filepath_tmp = GetAuthCookieFile(true);
|
||||||
file.open(filepath_tmp);
|
file.open(filepath_tmp);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
LogInfo("Unable to open cookie authentication file %s for writing\n", fs::PathToString(filepath_tmp));
|
LogWarning("Unable to open cookie authentication file %s for writing", fs::PathToString(filepath_tmp));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file << cookie;
|
file << cookie;
|
||||||
|
@ -116,14 +116,14 @@ bool GenerateAuthCookie(std::string* cookie_out, std::optional<fs::perms> cookie
|
||||||
|
|
||||||
fs::path filepath = GetAuthCookieFile(false);
|
fs::path filepath = GetAuthCookieFile(false);
|
||||||
if (!RenameOver(filepath_tmp, filepath)) {
|
if (!RenameOver(filepath_tmp, filepath)) {
|
||||||
LogInfo("Unable to rename cookie authentication file %s to %s\n", fs::PathToString(filepath_tmp), fs::PathToString(filepath));
|
LogWarning("Unable to rename cookie authentication file %s to %s", fs::PathToString(filepath_tmp), fs::PathToString(filepath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cookie_perms) {
|
if (cookie_perms) {
|
||||||
std::error_code code;
|
std::error_code code;
|
||||||
fs::permissions(filepath, cookie_perms.value(), fs::perm_options::replace, code);
|
fs::permissions(filepath, cookie_perms.value(), fs::perm_options::replace, code);
|
||||||
if (code) {
|
if (code) {
|
||||||
LogInfo("Unable to set permissions on cookie authentication file %s\n", fs::PathToString(filepath_tmp));
|
LogWarning("Unable to set permissions on cookie authentication file %s", fs::PathToString(filepath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue