dout(20) << __func__ << " name " << name << " path " << epath
<< " size " << size << " create=" << (int)create << dendl;
int r = 0;
+ unsigned flags = O_RDWR;
+ if (create)
+ flags |= O_CREAT;
if (epath.length()) {
if (!epath.compare(0, sizeof(SPDK_PREFIX)-1, SPDK_PREFIX)) {
string symbol_spdk_file = path + "/" + epath;
<< symbol_spdk_file << ": " << cpp_strerror(r) << dendl;
return r;
}
- int fd = ::openat(path_fd, epath.c_str(), O_RDWR, 0644);
+ int fd = ::openat(path_fd, epath.c_str(), flags, 0644);
if (fd < 0) {
r = -errno;
derr << __func__ << " failed to open " << epath << " file: "
}
}
if (size) {
- unsigned flags = O_RDWR;
- if (create)
- flags |= O_CREAT;
int fd = ::openat(path_fd, name.c_str(), flags, 0644);
if (fd >= 0) {
// block file is present