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);
|
Socket_fs::Context *context = dynamic_cast<Socket_fs::Context *>(fd->context);
|
||||||
if (!context) return Errno(EBADF);
|
if (!context) return Errno(EBADF);
|
||||||
|
|
||||||
::unlink(context->path.base());
|
Absolute_path path = context->path;
|
||||||
|
|
||||||
Genode::destroy(&global_allocator, context);
|
Genode::destroy(&global_allocator, context);
|
||||||
Libc::file_descriptor_allocator()->free(fd);
|
Libc::file_descriptor_allocator()->free(fd);
|
||||||
|
|
||||||
|
/* finally release the socket path after all handles are closed */
|
||||||
|
::unlink(path.base());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user