From 530c259e71fb0b583c56c6ee7bc4f367efba8251 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 3 Jun 2024 18:06:01 +0300 Subject: [PATCH] Kernel: Close unix domain socket when it gets destoyed Inode closing is something that needs a complete rework. Currently all sockets are closed when close() is called, which leads to connection closing if you fork()/exec() with socket being marked as CLOEXEC. Inodes should probably only be closed once they are not referenced anywhere. --- kernel/include/kernel/Networking/UNIX/Socket.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/include/kernel/Networking/UNIX/Socket.h b/kernel/include/kernel/Networking/UNIX/Socket.h index e8898201..548b449a 100644 --- a/kernel/include/kernel/Networking/UNIX/Socket.h +++ b/kernel/include/kernel/Networking/UNIX/Socket.h @@ -33,6 +33,7 @@ namespace Kernel private: UnixDomainSocket(SocketType, ino_t, const TmpInodeInfo&); + ~UnixDomainSocket() { on_close_impl(); } BAN::ErrorOr add_packet(BAN::ConstByteSpan);