Repository: mesos
Updated Branches:
  refs/heads/master 2f5e4492a -> 84a3adb92


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/84a3adb9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/84a3adb9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/84a3adb9

Branch: refs/heads/master
Commit: 84a3adb92e53a5683584df84971272d840cbe96b
Parents: 2f5e449
Author: Neil Conway <neil.con...@gmail.com>
Authored: Wed Sep 21 10:23:47 2016 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Wed Sep 21 10:23:47 2016 -0700

----------------------------------------------------------------------
 src/linux/fs.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/84a3adb9/src/linux/fs.cpp
----------------------------------------------------------------------
diff --git a/src/linux/fs.cpp b/src/linux/fs.cpp
index 369a302..4b10141 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(std::move(entry));
@@ -150,7 +151,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);
   }

Reply via email to