Skip to content

Commit

Permalink
#236: Fixed TestPathUtil.TestODirectFileCreationInDir
Browse files Browse the repository at this point in the history
Summary: These was missing '/' in `CheckODirectTempFileCreationInDir` (path_util.cc)

Test Plan:
- Jenkins.
- Run test under root user.

Reviewers: mikhail, ayush_sengupta1991

Reviewed By: ayush_sengupta1991

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D4659
  • Loading branch information
ttyusupov committed Apr 24, 2018
1 parent 26552c5 commit bb204e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/yb/util/path_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ Status SetupRootDir(

Status CheckODirectTempFileCreationInDir(Env* env,
const std::string& dir_path) {
string name_template = dir_path + kTmpTemplateSuffix;
std::string name_template;
if (!dir_path.empty() && dir_path.back() == '/') {
name_template = dir_path + kTmpTemplateSuffix;
} else {
name_template = dir_path + '/' + kTmpTemplateSuffix;
}
ThreadRestrictions::AssertIOAllowed();
std::unique_ptr<char[]> fname(new char[name_template.size() + 1]);
::snprintf(fname.get(), name_template.size() + 1, "%s", name_template.c_str());
Expand Down

0 comments on commit bb204e4

Please sign in to comment.