libc/socket_fs: unlink during close

If 'close' does not call 'unlink' like 'shutdown', the Lxip_socket_dir
never gets destroyed and thus the socket server leaks resources like
RAM and ports.

Ref #2285
This commit is contained in:
Martin Stein 2017-02-21 14:50:24 +01:00 committed by Christian Helmuth
parent d5b1f4fa5f
commit d61cb2714c

View File

@ -795,6 +795,8 @@ int Socket_plugin::close(Libc::File_descriptor *fd)
Socket_context *context = dynamic_cast<Socket_context *>(fd->context); Socket_context *context = dynamic_cast<Socket_context *>(fd->context);
if (!context) return Errno(EBADF); if (!context) return Errno(EBADF);
::unlink(context->path.base());
Genode::destroy(Genode::env()->heap(), context); Genode::destroy(Genode::env()->heap(), context);
Libc::file_descriptor_allocator()->free(fd); Libc::file_descriptor_allocator()->free(fd);