From 0a771e2c3a819061febaf227ae64b507107ca0df Mon Sep 17 00:00:00 2001 From: Da Zheng Date: Thu, 30 Jun 2016 17:57:46 -0400 Subject: [PATCH] [Matrix]: check new name when renaming an EM object. --- matrix/EM_object.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/matrix/EM_object.cpp b/matrix/EM_object.cpp index c52320e2..8c4445a5 100644 --- a/matrix/EM_object.cpp +++ b/matrix/EM_object.cpp @@ -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;