]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/psim.cc: catch ceph::buffer::end_of_buffer exception
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 13 Nov 2014 13:57:23 +0000 (14:57 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 13 Nov 2014 22:39:10 +0000 (23:39 +0100)
Fix for:

CID 717163 (#1 of 1): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char **) an exception of type
 ceph::buffer::end_of_buffer is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/tools/psim.cc

index 6ea5a5dbf65e48fc5a853a1ba069b1519e62ecfb..3022b1c15042b7f1718b1b764b48bee8e35799ba 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
 
 #include "osd/OSDMap.h"
 #include "include/buffer.h"
@@ -15,7 +17,13 @@ int main(int argc, char **argv)
     return 1;
   }
   OSDMap osdmap;
-  osdmap.decode(bl);
+
+  try {
+    osdmap.decode(bl);
+  } catch (ceph::buffer::end_of_buffer &eob) {
+    cout << "Exception (end_of_buffer) in decode(), exit." << std::endl;
+    exit(1);
+  }
 
   //osdmap.set_primary_affinity(0, 0x8000);
   //osdmap.set_primary_affinity(3, 0);