summaryrefslogtreecommitdiff
path: root/Kernel/TTY
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-01 22:53:58 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-01 23:04:40 +0200
commit0a94b4233f86da44c384657a297cdbe9164d029c (patch)
treed69151c35b0e5faacf357603b654013a80fadd3d /Kernel/TTY
parent9b2dd0f3b4cc64074efdf5599dcda0b79ddc0831 (diff)
downloadserenity-0a94b4233f86da44c384657a297cdbe9164d029c.zip
Kernel: Don't use ref_count() in MasterPTY::close()
With the recent fixes to how close() gets called this is not necessary anymore.
Diffstat (limited to 'Kernel/TTY')
-rw-r--r--Kernel/TTY/MasterPTY.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp
index 42a80baf58..6a82964bea 100644
--- a/Kernel/TTY/MasterPTY.cpp
+++ b/Kernel/TTY/MasterPTY.cpp
@@ -94,14 +94,13 @@ bool MasterPTY::can_write_from_slave() const
KResult MasterPTY::close()
{
- if (ref_count() == 2) {
- InterruptDisabler disabler;
- // After the closing FileDescription dies, slave is the only thing keeping me alive.
- // From this point, let's consider ourselves closed.
- m_closed = true;
+ InterruptDisabler disabler;
+ // After the closing FileDescription dies, slave is the only thing keeping me alive.
+ // From this point, let's consider ourselves closed.
+ m_closed = true;
+ if (m_slave)
m_slave->hang_up();
- }
return KSuccess;
}