mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
Kernel: Allow File::close() to fail
And pass the result through to sys$close() return value. Fixes https://github.com/SerenityOS/serenity/issues/427
This commit is contained in:
parent
d4ddb0013c
commit
1b4e88fb59
12 changed files with 23 additions and 15 deletions
|
@ -46,8 +46,9 @@ KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
|
|||
return description;
|
||||
}
|
||||
|
||||
void File::close()
|
||||
KResult File::close()
|
||||
{
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
int File::ioctl(FileDescription&, unsigned, FlatPtr)
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
virtual ~File();
|
||||
|
||||
virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options);
|
||||
virtual void close();
|
||||
virtual KResult close();
|
||||
|
||||
virtual bool can_read(const FileDescription&, size_t) const = 0;
|
||||
virtual bool can_write(const FileDescription&, size_t) const = 0;
|
||||
|
|
|
@ -256,9 +256,11 @@ MasterPTY* FileDescription::master_pty()
|
|||
return static_cast<MasterPTY*>(m_file.ptr());
|
||||
}
|
||||
|
||||
int FileDescription::close()
|
||||
KResult FileDescription::close()
|
||||
{
|
||||
return 0;
|
||||
if (m_file->ref_count() > 1)
|
||||
return KSuccess;
|
||||
return m_file->close();
|
||||
}
|
||||
|
||||
String FileDescription::absolute_path() const
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
set_writable(options & O_WRONLY);
|
||||
}
|
||||
|
||||
int close();
|
||||
KResult close();
|
||||
|
||||
off_t seek(off_t, int whence);
|
||||
ssize_t read(u8*, ssize_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue