diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc index 64b6614d0f..fe0ed5f95b 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; }