Catch 'File_system::Lookup_failed' exception

In 'Fs_file_system::open()' the call of '_fs.dir()' can throw a
'File_system::Lookup_failed' exception, which gets explicitly caught
with this patch.

Fixes #246.
This commit is contained in:
Christian Prochaska 2012-06-13 19:19:48 +02:00 committed by Norman Feske
parent 4fc9383c31
commit 9a8fb36b1c

View File

@ -335,11 +335,12 @@ namespace Noux {
if (create)
PDBG("creation of file %s requested", file_name.base() + 1);
::File_system::Dir_handle dir = _fs.dir(dir_path.base(), false);
Fs_handle_guard dir_guard(_fs, dir);
Sysio::Open_error error = Sysio::OPEN_ERR_UNACCESSIBLE;
try {
::File_system::Dir_handle dir = _fs.dir(dir_path.base(), false);
Fs_handle_guard dir_guard(_fs, dir);
::File_system::File_handle file = _fs.file(dir, file_name.base() + 1,
mode, create);
return new (env()->heap()) Fs_vfs_handle(this, 0, file);
@ -348,6 +349,7 @@ namespace Noux {
error = Sysio::OPEN_ERR_NO_PERM; }
catch (::File_system::Invalid_handle) {
error = Sysio::OPEN_ERR_NO_PERM; }
catch (::File_system::Lookup_failed) { }
sysio->error.open = error;
return 0;