From 8a484be5f5d4ac151860bb780a4935fd4cb67d4f Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Fri, 5 Oct 2012 11:12:07 -0700 Subject: [PATCH] rbd: Make lock list adapt 'number' of msg (1 lock, 2 locks) Signed-off-by: Dan Mick Reviewed-by: Josh Durgin --- src/rbd.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rbd.cc b/src/rbd.cc index 4d26ddd7f3f..de37955680e 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -487,9 +487,10 @@ static int do_lock_list(librbd::Image& image) return r; if (lockers.size()) { - cout << "There are " << lockers.size() + bool one = (lockers.size() == 1); + cout << "There " << (one ? "is " : "are ") << lockers.size() << (exclusive ? " exclusive" : " shared") - << " lock(s) on this image.\n"; + << " lock" << (one ? "" : "s") << " on this image.\n"; if (!exclusive) cout << "Lock tag: " << tag << "\n";