From: Joao Eduardo Luis Date: Tue, 30 Apr 2013 16:12:05 +0000 (+0100) Subject: mon: Monitor: fix bug on _pick_random_mon() that would choose an invalid rank X-Git-Tag: v0.61~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb270f86a4b3cff2afc0d53a490860be2621efa3;p=ceph.git mon: Monitor: fix bug on _pick_random_mon() that would choose an invalid rank Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 54e722ac948c..b9afa4265d8f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1071,6 +1071,8 @@ int Monitor::_pick_random_mon(int other) return 0; int max = monmap->size(); + if (other >= 0) + max--; int n = sync_rng() % max; if (other >= 0 && n >= other) n++;