diff --git a/repos/os/src/app/rom_to_file/main.cc b/repos/os/src/app/rom_to_file/main.cc index cc9b9b7ad0..542a454335 100644 --- a/repos/os/src/app/rom_to_file/main.cc +++ b/repos/os/src/app/rom_to_file/main.cc @@ -124,7 +124,11 @@ void Rom_to_file::Main::_handle_update() Handle_guard dir_guard(_fs, dir_handle); File_handle handle; - handle = _fs.file(dir_handle, file_name, File_system::WRITE_ONLY, true); + try { + handle = _fs.file(dir_handle, file_name, File_system::WRITE_ONLY, true); + } catch (Node_already_exists) { + handle = _fs.file(dir_handle, file_name, File_system::WRITE_ONLY, false); + } _fs.truncate(handle, 0); @@ -136,6 +140,7 @@ void Rom_to_file::Main::_handle_update() } _fs.close(handle); + } catch (Permission_denied) { error(Cstring(dir_path), file_name, ": permission denied");