summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-07-16 19:52:40 -0400
committerAndrew Morrow <acm@mongodb.com>2015-07-21 20:17:57 -0400
commitfdf7d0817b5500a6d18a103ff073d104329e7364 (patch)
tree72a2a960e8f0f29c579b9d339d94a7789006ee01
parenta71f5f4b47422b5dc2e85d788d873efa66e31792 (diff)
downloadmongo-fdf7d0817b5500a6d18a103ff073d104329e7364.tar.gz
SERVER-19160 Drop trailing null bytes from OS X string sysctls
-rw-r--r--src/mongo/util/processinfo_osx.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/util/processinfo_osx.cpp b/src/mongo/util/processinfo_osx.cpp
index abbe2a62522..61acc99a9d8 100644
--- a/src/mongo/util/processinfo_osx.cpp
+++ b/src/mongo/util/processinfo_osx.cpp
@@ -147,8 +147,9 @@ Variant getSysctlByName(const char* sysctlName) {
log() << sysctlName << " unavailable" << endl;
return "";
}
- value.resize(len);
- return value;
+
+ // Drop any trailing NULL bytes by constructing Variant from a C string.
+ return value.c_str();
}
/**