From 8322878c2242d6779170257d651076feb7e781f0 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Thu, 8 May 2014 15:47:08 +0200 Subject: [PATCH] Objecter::calc_target(): init best_locality with 0 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 --- src/osdc/Objecter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 9da65b062c72a..07315d7e4db52 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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); -- 2.39.5