Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0b76cc

Browse files
authored
Merge pull request #15972 from rstudio/bugfix-error-after-fork
Avoid LOG_ERROR in code run after fork/before exec
2 parents d875907 + c3977a1 commit f0b76cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cpp/server_core/system/Pam.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <core/Log.hpp>
2222
#include <core/system/System.hpp>
23+
#include <shared_core/system/SyslogDestination.hpp>
2324

2425
namespace rstudio {
2526
namespace core {
@@ -187,22 +188,22 @@ int PAM::login(const std::string& username,
187188
&pamh_);
188189
if (status_ != PAM_SUCCESS)
189190
{
190-
LOG_ERROR_MESSAGE("pam_start failed: " + lastError());
191+
safeLogToSyslog("pam-login", log::LogLevel::ERR, "pam_start failed: " + lastError());
191192
return status_;
192193
}
193194

194195
status_ = ::pam_authenticate(pamh_, defaultFlags_);
195196
if (status_ != PAM_SUCCESS)
196197
{
197198
if (status_ != PAM_AUTH_ERR)
198-
LOG_ERROR_MESSAGE("pam_authenticate failed: " + lastError());
199+
safeLogToSyslog("pam-login", log::LogLevel::ERR, "pam_authenticate failed: " + lastError());
199200
return status_;
200201
}
201202

202203
status_ = ::pam_acct_mgmt(pamh_, defaultFlags_);
203204
if (status_ != PAM_SUCCESS)
204205
{
205-
LOG_ERROR_MESSAGE("pam_acct_mgmt failed: " + lastError());
206+
safeLogToSyslog("pam-login", log::LogLevel::ERR, "pam_acct_mgmt failed: " + lastError());
206207
return status_;
207208
}
208209

0 commit comments

Comments
 (0)