From 9a8fb36b1c345d259380f9862162916bad40f102 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Wed, 13 Jun 2012 19:19:48 +0200 Subject: [PATCH] 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. --- ports/src/noux/fs_file_system.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ports/src/noux/fs_file_system.h b/ports/src/noux/fs_file_system.h index d6ca918d1e..fa84dc0d89 100644 --- a/ports/src/noux/fs_file_system.h +++ b/ports/src/noux/fs_file_system.h @@ -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;