From 783956ccb6dcb0cab42f11a167080b3c76e78190 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Mon, 29 Dec 2014 17:25:58 +0000 Subject: [PATCH] tools: ceph-monstore-tool: validate start/stop vals on commands that use 'start' and 'stop'/'end' values, we should validate them and inform the user when 'stop' > 'start'. Signed-off-by: Joao Eduardo Luis --- src/tools/ceph_monstore_tool.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index d643411efe304..65cddb462ab45 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -426,6 +426,14 @@ int main(int argc, char **argv) { goto done; } + if (dstart > dstop) { + std::cerr << "error: 'start' version (value: " << dstart << ") " + << " is greater than 'end' version (value: " << dstop << ")" + << std::endl; + err = EINVAL; + goto done; + } + version_t v = dstart; for (; v <= dstop; ++v) { bufferlist bl; @@ -487,6 +495,14 @@ int main(int argc, char **argv) { goto done; } + if (dstart > dstop) { + std::cerr << "error: 'start' version (value: " << dstart << ") " + << " is greater than 'stop' version (value: " << dstop << ")" + << std::endl; + err = EINVAL; + goto done; + } + TraceIter iter(outpath.c_str()); iter.init(); while (true) { -- 2.39.5