Vfs::Dir_file_system: do not use Vfs_handle for opening directories as files

The Dir_file_system uses static cast to convert handles from the
application to a plugin local type. For this reason, only the local
handle type may be returned from 'opendir' or 'open'. This fixes the
unexpected behavior when opening directories as files.

Fix #2533
This commit is contained in:
Emery Hemingway 2018-02-13 17:57:00 +01:00 committed by Norman Feske
parent 2bbb183a18
commit 013eb506a8

View File

@ -541,7 +541,7 @@ class Vfs::Dir_file_system : public File_system
*/
if (directory(path)) {
try {
*out_handle = new (alloc) Vfs_handle(*this, *this, alloc, 0);
*out_handle = new (alloc) Dir_vfs_handle(*this, *this, alloc, path);
return OPEN_OK;
}
catch (Genode::Out_of_ram) { return OPEN_ERR_OUT_OF_RAM; }