]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter::calc_target(): init best_locality with 0
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 8 May 2014 13:47:08 +0000 (15:47 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 8 May 2014 13:47:08 +0000 (15:47 +0200)
Init best_locality to fix:

osdc/Objecter.cc:1519:26: warning: variable 'best_locality' may be
 uninitialized when used here [-Wconditional-uninitialized]
              (locality >= 0 && best_locality >= 0 &&
                                ^~~~~~~~~~~~~
osdc/Objecter.cc:1511:19: note: initialize the variable 'best_locality'
 to silence this warning
        int best_locality;
                         ^
                          = 0

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osdc/Objecter.cc

index 9da65b062c72abdfd70e928bd28efa028684b55a..07315d7e4db529ec664f7cbefb51e45c74dc94ee 100644 (file)
@@ -1508,7 +1508,7 @@ int Objecter::calc_target(op_target_t *t)
        // look for a local replica.  prefer the primary if the
        // distance is the same.
        int best = -1;
-       int best_locality;
+       int best_locality = 0;
        for (unsigned i = 0; i < acting.size(); ++i) {
          int locality = osdmap->crush->get_common_ancestor_distance(
                 cct, acting[i], crush_location);