From 516a6fd095f54d57ecd77650840345d464009631 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 Jul 2019 11:49:32 +0800 Subject: [PATCH] tools/ceph_conf: replace exit(n) with "return n" a step to the leak-free `main()`, as we use a smart pointer to manage the lifecycle of `cct`, it'd be better to let the RAII to do its job. Signed-off-by: Kefu Chai (cherry picked from commit 3aef54b214754713e9eaf536ca0fdb95f60e8ebe) --- src/tools/ceph_conf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/ceph_conf.cc b/src/tools/ceph_conf.cc index fb046f8eeb2b8..dd96b525e7146 100644 --- a/src/tools/ceph_conf.cc +++ b/src/tools/ceph_conf.cc @@ -214,7 +214,7 @@ int main(int argc, const char **argv) if (pos == string::npos) { cerr << "expecting argument like 'key=value' for --filter-key-value (not '" << val << "')" << std::endl; usage(); - exit(1); + return EXIT_FAILURE; } string key(val, 0, pos); string value(val, pos+1); @@ -235,7 +235,7 @@ int main(int argc, const char **argv) } cerr << std::endl; usage(); - exit(1); + return EXIT_FAILURE; } } } @@ -243,7 +243,7 @@ int main(int argc, const char **argv) cct->_log->flush(); if (action == "help") { usage(); - exit(0); + return EXIT_SUCCESS; } else if (action == "list-sections") { return list_sections(section_list_prefix, filter_key, filter_key_value); } else if (action == "lookup") { @@ -253,6 +253,6 @@ int main(int argc, const char **argv) } else { cerr << "You must give an action, such as --lookup or --list-all-sections." << std::endl; cerr << "Pass --help for more help." << std::endl; - exit(1); + return EXIT_FAILURE; } } -- 2.39.5