From 1ee15336da948ad2e4f1cc82bb324d734c4a2caf Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Wed, 3 May 2017 11:48:49 +0300 Subject: [PATCH] rgw: get_bucket_header will return -ENOENT when there is no header Signed-off-by: Orit Wasserman --- src/cls/rgw/cls_rgw.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 9335cdd4c694c..cc2bd3eccfd18 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -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); -- 2.39.5