From adc3aa452a7e412ef94380111c2cfab9ef385b18 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Tue, 27 Feb 2018 14:57:38 +0100 Subject: [PATCH] libc: close all handles of a socket before release This prevents diagnostic messages like Error: partial write detected 0 vs 31 for writes into already released socket directories due to a still-open handle to the socket data file. --- repos/libports/src/lib/libc/socket_fs_plugin.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc index 64b6614d0..fe0ed5f95 100644 --- a/repos/libports/src/lib/libc/socket_fs_plugin.cc +++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc @@ -927,11 +927,14 @@ int Socket_fs::Plugin::close(Libc::File_descriptor *fd) Socket_fs::Context *context = dynamic_cast(fd->context); if (!context) return Errno(EBADF); - ::unlink(context->path.base()); + Absolute_path path = context->path; Genode::destroy(&global_allocator, context); Libc::file_descriptor_allocator()->free(fd); + /* finally release the socket path after all handles are closed */ + ::unlink(path.base()); + return 0; }