]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: get_bucket_header will return -ENOENT when there is no header
authorOrit Wasserman <owasserm@redhat.com>
Wed, 3 May 2017 08:48:49 +0000 (11:48 +0300)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:39 +0000 (13:17 -0700)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/cls/rgw/cls_rgw.cc

index 9335cdd4c694c8bd0ef6d56f4e8deb732cb9a76b..cc2bd3eccfd18fb810ebf1656246bd078fd781c3 100644 (file)
@@ -370,6 +370,10 @@ static int read_bucket_header(cls_method_context_t hctx, struct rgw_bucket_dir_h
   int rc = cls_cxx_map_read_header(hctx, &bl);
   if (rc < 0)
     return rc;
+
+  if (bl.length() == 0) {
+      return -ENOENT;
+  }
   bufferlist::iterator iter = bl.begin();
   try {
     ::decode(*header, iter);