]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmaptool: check return values
authorSage Weil <sage@inktank.com>
Fri, 28 Sep 2012 14:55:08 +0000 (07:55 -0700)
committerSage Weil <sage@inktank.com>
Fri, 28 Sep 2012 20:18:06 +0000 (13:18 -0700)
CID 716864: Unchecked return value (CHECKED_RETURN)
At (155): Calling function "ceph::buffer::list::read_file(char const *, std::string *)" without checking return value (as is done elsewhere 14 out of 16 times).

Signed-off-by: Sage Weil <sage@inktank.com>
src/osdmaptool.cc

index e5fc60dc9c179799bdbb57e1601cf44a930ef8ce..bb907d7d516130a04e20d3cd2b58c8c66746bdb9 100644 (file)
@@ -135,7 +135,11 @@ int main(int argc, const char **argv)
       f << fn << "/" << i;
       bufferlist bl;
       string error, s = f.str();
-      bl.read_file(s.c_str(), &error);
+      int r = bl.read_file(s.c_str(), &error);
+      if (r < 0) {
+       cerr << "unable to read " << s << ": " << cpp_strerror(r) << std::endl;
+       exit(1);
+      }
       cout << s << " got " << bl.length() << " bytes" << std::endl;
       OSDMap *o = new OSDMap;
       o->decode(bl);