]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: don't hide error in case of failed pool ctx creation
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 30 Aug 2011 21:14:05 +0000 (14:14 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 30 Aug 2011 21:17:40 +0000 (14:17 -0700)
src/librados.cc

index d9471f5880dd486a6faf9534a3131ca1eba78635..c2d6d0b3e00f94d2d77b95bc427b36e15ad1b269 100644 (file)
@@ -3491,14 +3491,14 @@ extern "C" int rados_ioctx_create(rados_t cluster, const char *name, rados_ioctx
 {
   librados::RadosClient *radosp = (librados::RadosClient *)cluster;
   int64_t poolid = radosp->lookup_pool(name);
-  if (poolid >= 0) {
-    librados::IoCtxImpl *ctx = new librados::IoCtxImpl(radosp, poolid, name, CEPH_NOSNAP);
-    if (!ctx)
-      return -ENOMEM;
-    *io = ctx;
-    ctx->get();
-    return 0;
-  }
+  if (poolid < 0)
+    return (int)poolid;
+
+  librados::IoCtxImpl *ctx = new librados::IoCtxImpl(radosp, poolid, name, CEPH_NOSNAP);
+  if (!ctx)
+    return -ENOMEM;
+  *io = ctx;
+  ctx->get();
   return 0;
 }