diff options
author | Andrew Morrow <acm@mongodb.com> | 2015-07-16 19:52:40 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2015-07-21 20:17:57 -0400 |
commit | fdf7d0817b5500a6d18a103ff073d104329e7364 (patch) | |
tree | 72a2a960e8f0f29c579b9d339d94a7789006ee01 | |
parent | a71f5f4b47422b5dc2e85d788d873efa66e31792 (diff) | |
download | mongo-fdf7d0817b5500a6d18a103ff073d104329e7364.tar.gz |
SERVER-19160 Drop trailing null bytes from OS X string sysctls
-rw-r--r-- | src/mongo/util/processinfo_osx.cpp | 5 |
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(); } /** |