mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
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.
This commit is contained in:
parent
cae33305b0
commit
7a1d09ef1a
3 changed files with 17 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue