Skip to content

Commit 1cd5afb

Browse files
committed
[bugfix] update permission of block dir to 774
1 parent ec2b2db commit 1cd5afb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ucm/store/pcstore/cc/domain/file/posix_file.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,17 @@ PosixFile::~PosixFile() { this->Close(); }
3737

3838
Status PosixFile::MkDir()
3939
{
40-
constexpr auto permission = (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH);
40+
constexpr auto permission = (S_IRWXU | S_IRWXG | S_IROTH);
4141
auto ret = mkdir(this->Path().c_str(), permission);
4242
auto eno = errno;
4343
if (ret != 0) {
44-
if (eno == EEXIST) {
45-
return Status::DuplicateKey();
46-
} else {
47-
UC_ERROR("Failed to create directory, path: {}, errcode: {}, errno: {}.", this->Path(),
48-
ret, eno);
49-
return Status::OsApiError();
50-
}
44+
if (eno == EEXIST) { return Status::DuplicateKey(); }
45+
UC_ERROR("Failed({},{}) to create dir({}).", ret, eno, this->Path());
46+
return Status::OsApiError();
5147
}
48+
ret = chmod(this->Path().c_str(), permission);
49+
eno = errno;
50+
if (ret != 0) { UC_WARN("Failed({},{}) to set perm on dir({}).", ret, eno, this->Path()); }
5251
return Status::OK();
5352
}
5453

0 commit comments

Comments
 (0)