From b38caee08fe2248b6dfd4511aec898f9569c51cb Mon Sep 17 00:00:00 2001 From: Zulai Wang Date: Thu, 3 Jun 2021 13:13:15 +0800 Subject: [PATCH] rgw: require bucket name in bucket chown Checking and reporting missing the mandatory parameter avoid clueless error message for bucket chown. Signed-off-by: Zulai Wang (cherry picked from commit 158a1f4313c0fa206031ede6f48a26c0c7467d57) --- src/rgw/rgw_admin.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 5bd78a668e995..a922182571d0b 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -6171,6 +6171,10 @@ int main(int argc, const char **argv) } if (opt_cmd == OPT::BUCKET_CHOWN) { + if (bucket_name.empty()) { + cerr << "ERROR: bucket name not specified" << std::endl; + return EINVAL; + } bucket_op.set_bucket_name(bucket_name); bucket_op.set_new_bucket_name(new_bucket_name); -- 2.39.5