mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
app/rom_to_file: catch Node_already_exists and overwrite files
Ref #1934
This commit is contained in:
parent
6106e64aac
commit
29b3fff5eb
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user