summaryrefslogtreecommitdiff
path: root/source/fud_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/fud_file.cpp')
-rw-r--r--source/fud_file.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/source/fud_file.cpp b/source/fud_file.cpp
index 8f84648..94f1f27 100644
--- a/source/fud_file.cpp
+++ b/source/fud_file.cpp
@@ -30,13 +30,8 @@ FileResult RegularFile::open(
StringView filename,
FileAccessMode mode,
OpenFlags flags,
- Option<int> dirFdOption,
- Allocator* allocator)
+ Option<int> dirFdOption)
{
- if (allocator == nullptr) {
- return FileResult::error(FudStatus::NullPointer);
- }
-
if (!filename.nullTerminated()) {
return FileResult::error(FudStatus::ArgumentInvalid);
}
@@ -115,6 +110,8 @@ FileResult RegularFile::open(
return FileResult::error(FudStatus::ObjectInvalid);
}
+ file.m_openFlags = flags;
+
return FileResult::okay(std::move(file));
}
@@ -124,13 +121,8 @@ FileResult RegularFile::create(
OpenFlags flags,
Permissions permissions,
bool exclusive,
- Option<int> dirFdOption,
- Allocator* allocator)
+ Option<int> dirFdOption)
{
- if (allocator == nullptr) {
- return FileResult::error(FudStatus::NullPointer);
- }
-
if (!filename.nullTerminated()) {
return FileResult::error(FudStatus::ArgumentInvalid);
}
@@ -218,7 +210,7 @@ RegularFile::~RegularFile()
static_cast<void>(this->close());
}
-RegularFile::RegularFile(RegularFile&& rhs) noexcept : m_fd{rhs.m_fd}, m_modeFlags{rhs.m_modeFlags}
+RegularFile::RegularFile(RegularFile&& rhs) noexcept : m_fd{rhs.m_fd}, m_openFlags{rhs.m_openFlags}, m_modeFlags{rhs.m_modeFlags}
{
rhs.m_fd = -1;
}
@@ -232,6 +224,7 @@ RegularFile& RegularFile::operator=(RegularFile&& rhs) noexcept
static_cast<void>(this->close());
m_fd = rhs.m_fd;
+ m_openFlags = rhs.m_openFlags;
m_modeFlags = rhs.m_modeFlags;
rhs.m_fd = -1;
@@ -250,6 +243,7 @@ FudStatus RegularFile::take(RegularFile& rhs)
}
m_fd = rhs.m_fd;
+ m_openFlags = rhs.m_openFlags;
m_modeFlags = rhs.m_modeFlags;
rhs.m_fd = -1;