From: Joao Eduardo Luis Date: Mon, 29 Dec 2014 17:25:58 +0000 (+0000) Subject: tools: ceph-monstore-tool: validate start/stop vals X-Git-Tag: v0.92~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3274%2Fhead;p=ceph.git 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 --- diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index d643411efe30..65cddb462ab4 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) {