mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
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.
This commit is contained in:
parent
cd7cb5fbf4
commit
adc3aa452a
@ -927,11 +927,14 @@ int Socket_fs::Plugin::close(Libc::File_descriptor *fd)
|
||||
Socket_fs::Context *context = dynamic_cast<Socket_fs::Context *>(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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user