diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-04-30 10:33:33 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-30 11:42:35 +0200 |
commit | 7a1d09ef1a79f43ae39bc11f3c529cf420699c76 (patch) | |
tree | c6d90513a21817cd86739c982e43cc4264fd235d /Kernel/FileSystem/FileDescription.cpp | |
parent | cae33305b05fee14fb6c8035b7b240a14d555c2e (diff) | |
download | serenity-7a1d09ef1a79f43ae39bc11f3c529cf420699c76.zip |
Kernel: Closing a file descriptor should not always close the file
When there is more than one file descriptor for a file closing
one of them should not close the underlying file.
Previously this relied on the file's ref_count() but at least
for sockets this didn't work reliably.
Diffstat (limited to 'Kernel/FileSystem/FileDescription.cpp')
-rw-r--r-- | Kernel/FileSystem/FileDescription.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index 9ea9f23842..4918f5f83d 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -288,7 +288,7 @@ MasterPTY* FileDescription::master_pty() KResult FileDescription::close() { - if (m_file->ref_count() > 1) + if (m_file->attach_count() > 0) return KSuccess; return m_file->close(); } |