You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/10/18 21:27:58 UTC
[2/3] mesos git commit: Fixed an uninitialized variable warning.
Fixed an uninitialized variable warning.
Observed with clang-tidy.
Review: https://reviews.apache.org/r/52113/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aa6dad21
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aa6dad21
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aa6dad21
Branch: refs/heads/1.0.x
Commit: aa6dad2117ef088ed086df760a9488e77376885d
Parents: 5ee93ea
Author: Neil Conway <ne...@gmail.com>
Authored: Wed Sep 21 10:23:47 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Oct 18 14:19:05 2016 -0700
----------------------------------------------------------------------
src/linux/fs.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa6dad21/src/linux/fs.cpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp
index 978953f..c7ca2b1 100644
--- a/src/linux/fs.cpp
+++ b/src/linux/fs.cpp
@@ -117,13 +117,14 @@ Try<MountInfoTable> MountInfoTable::read(
// them according to the invariant that all parent entries
// appear before their child entries.
if (hierarchicalSort) {
- int rootParentId;
+ Option<int> rootParentId = None();
// Construct a representation of the mount hierarchy using a hashmap.
hashmap<int, vector<MountInfoTable::Entry>> parentToChildren;
foreach (const MountInfoTable::Entry& entry, table.entries) {
if (entry.target == "/") {
+ CHECK_NONE(rootParentId);
rootParentId = entry.parent;
}
parentToChildren[entry.parent].push_back(entry);
@@ -160,7 +161,8 @@ Try<MountInfoTable> MountInfoTable::read(
// We know the node with a parent id of
// `rootParentId` is the root mount point.
- sortFrom(rootParentId);
+ CHECK_SOME(rootParentId);
+ sortFrom(rootParentId.get());
table.entries = std::move(sortedEntries);
}