Skip to content

Commit

Permalink
rgw: fix for duplicates in list_periods()
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit abed30b)
  • Loading branch information
cbodley authored and yehudasa committed May 10, 2016
1 parent 7ea6e78 commit 9bb17db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/rgw/rgw_rados.cc
Expand Up @@ -3826,14 +3826,15 @@ int RGWRados::list_periods(list<string>& periods)
if (ret < 0) {
return ret;
}
for(list<string>::iterator iter = raw_periods.begin(); iter != raw_periods.end(); iter++) {
size_t pos = iter->find(".");
if ( pos != std::string::npos) {
periods.push_back(iter->substr(0, pos));
for (const auto& oid : raw_periods) {
size_t pos = oid.find(".");
if (pos != std::string::npos) {
periods.push_back(oid.substr(0, pos));
} else {
periods.push_back(*iter);
periods.push_back(oid);
}
}
periods.sort(); // unique() only detects duplicates if they're adjacent
periods.unique();
return 0;
}
Expand Down

0 comments on commit 9bb17db

Please sign in to comment.