summaryrefslogtreecommitdiff
path: root/src/mongo/db/initialize_server_global_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/initialize_server_global_state.cpp')
-rw-r--r--src/mongo/db/initialize_server_global_state.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp
index e37d6809049..18c2cf45555 100644
--- a/src/mongo/db/initialize_server_global_state.cpp
+++ b/src/mongo/db/initialize_server_global_state.cpp
@@ -64,7 +64,7 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl
-namespace mongo {
+namespace mongo::initialize_server_global_state {
#ifndef _WIN32
static void croak(StringData prefix, int savedErr = errno) {
@@ -411,7 +411,7 @@ MONGO_INITIALIZER(RegisterShortCircuitExitHandler)(InitializerContext*) {
uasserted(ErrorCodes::InternalError, "Failed setting short-circuit exit handler.");
}
-bool initializeServerGlobalState(ServiceContext* service, PidFileWrite pidWrite) {
+bool checkSocketPath() {
#ifndef _WIN32
if (!serverGlobalParams.noUnixSocket &&
!boost::filesystem::is_directory(serverGlobalParams.socket)) {
@@ -420,16 +420,14 @@ bool initializeServerGlobalState(ServiceContext* service, PidFileWrite pidWrite)
}
#endif
- if (!serverGlobalParams.pidFile.empty() && pidWrite == PidFileWrite::kWrite) {
- if (!writePidFile(serverGlobalParams.pidFile)) {
- // error message logged in writePidFile
- return false;
- }
- }
-
return true;
}
+bool writePidFile() {
+ return serverGlobalParams.pidFile.empty() ? true
+ : mongo::writePidFile(serverGlobalParams.pidFile);
+}
+
#ifndef _WIN32
namespace {
// Handling for `honorSystemUmask` and `processUmask` setParameters.
@@ -541,4 +539,4 @@ void ProcessUMaskServerParameter::append(OperationContext*,
#endif
}
-} // namespace mongo
+} // namespace mongo::initialize_server_global_state