Skip to content

Commit

Permalink
[Matrix]: check new name when renaming an EM object.
Browse files Browse the repository at this point in the history
  • Loading branch information
zheng-da committed Jun 30, 2016
1 parent 8934a58 commit 0a771e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions matrix/EM_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ EM_object::file_holder::~file_holder()

bool EM_object::file_holder::set_persistent(const std::string &new_name)
{
auto ret = new_name.find("/");
if (ret != std::string::npos) {
fprintf(stderr, "can't rename to %s because it contains '/'\n",
new_name.c_str());
return false;
}

safs::safs_file f(safs::get_sys_RAID_conf(), file_name);
if (!f.rename(new_name))
return false;
Expand Down

0 comments on commit 0a771e2

Please sign in to comment.