summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/FileDescription.cpp
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-06-02 19:20:05 +0300
committerAndreas Kling <kling@serenityos.org>2020-06-02 21:49:47 +0200
commit1b4e88fb59d35d7d720de15ddbdd6975d7175964 (patch)
tree886a4779c79a02e1dc5ab35aff6aa2f72664caaa /Kernel/FileSystem/FileDescription.cpp
parentd4ddb0013cda7a8ef59e01883c643cac53448ef6 (diff)
downloadserenity-1b4e88fb59d35d7d720de15ddbdd6975d7175964.zip
Kernel: Allow File::close() to fail
And pass the result through to sys$close() return value. Fixes https://github.com/SerenityOS/serenity/issues/427
Diffstat (limited to 'Kernel/FileSystem/FileDescription.cpp')
-rw-r--r--Kernel/FileSystem/FileDescription.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 984eadfd50..4b76e4ca4a 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -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