Skip to content

Commit

Permalink
rgw: rgw_admin setup and destroy curl raii style
Browse files Browse the repository at this point in the history
Since a lot of rgw-admin commands can exit early

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
  • Loading branch information
theanalyst committed Mar 5, 2018
1 parent 08c4c05 commit 6fc49c7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/rgw/rgw_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,15 @@ int main(int argc, const char **argv)

rgw_user_init(store);
rgw_bucket_init(store->meta_mgr);
rgw::curl::setup_curl(boost::none);

struct rgw_curl_setup {
rgw_curl_setup() {
rgw::curl::setup_curl(boost::none);
}
~rgw_curl_setup() {
rgw::curl::cleanup_curl();
}
} curl_cleanup;

StoreDestructor store_destructor(store);

Expand Down Expand Up @@ -7247,6 +7255,5 @@ int main(int argc, const char **argv)
}
}

rgw::curl::cleanup_curl();
return 0;
}

0 comments on commit 6fc49c7

Please sign in to comment.