From: Matt Benjamin Date: Wed, 8 Jun 2022 19:01:00 +0000 (-0400) Subject: rgw: return ENOENT for NO_SUCH_BUCKET in radosgw-admin bucket stats X-Git-Tag: v18.0.0~615^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F46581%2Fhead;p=ceph.git rgw: return ENOENT for NO_SUCH_BUCKET in radosgw-admin bucket stats This was a recent behavior change. It might be tempting to normalize these, but I'm trying to avoid further changes in result codes. Fixes: https://tracker.ceph.com/issues/55975 Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 865da80d42252..43342c61988d0 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -108,6 +108,18 @@ static const DoutPrefixProvider* dpp() { } \ } while (0) +static inline int posix_errortrans(int r) +{ + switch(r) { + case ERR_NO_SUCH_BUCKET: + r = ENOENT; + break; + default: + break; + } + return r; +} + void usage() { cout << "usage: radosgw-admin [options...]" << std::endl; @@ -6967,7 +6979,7 @@ int main(int argc, const char **argv) int r = RGWBucketAdminOp::info(store, bucket_op, stream_flusher, null_yield, dpp()); if (r < 0) { cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl; - return -r; + return posix_errortrans(-r); } }