mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
committed by
Christian Helmuth
parent
2e266dfe3c
commit
cf904e0a5d
@@ -683,7 +683,9 @@ class Genode::New_file : Noncopyable
|
|||||||
Vfs::File_system &_fs;
|
Vfs::File_system &_fs;
|
||||||
Vfs::Vfs_handle &_handle;
|
Vfs::Vfs_handle &_handle;
|
||||||
|
|
||||||
Vfs::Vfs_handle &_init_handle(Directory &dir, Directory::Path const &rel_path)
|
Vfs::Vfs_handle &_init_handle(Directory &dir,
|
||||||
|
Directory::Path const &rel_path,
|
||||||
|
bool append)
|
||||||
{
|
{
|
||||||
/* create compound directory */
|
/* create compound directory */
|
||||||
{
|
{
|
||||||
@@ -708,7 +710,11 @@ class Genode::New_file : Noncopyable
|
|||||||
throw Create_failed();
|
throw Create_failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_ptr->fs().ftruncate(handle_ptr, 0);
|
Vfs::Directory_service::Stat stat { };
|
||||||
|
if (!append)
|
||||||
|
handle_ptr->fs().ftruncate(handle_ptr, 0);
|
||||||
|
else if (handle_ptr->ds().stat(path.string(), stat) == Vfs::Directory_service::STAT_OK)
|
||||||
|
handle_ptr->seek(stat.size);
|
||||||
|
|
||||||
return *handle_ptr;
|
return *handle_ptr;
|
||||||
}
|
}
|
||||||
@@ -720,10 +726,10 @@ class Genode::New_file : Noncopyable
|
|||||||
*
|
*
|
||||||
* \throw Create_failed
|
* \throw Create_failed
|
||||||
*/
|
*/
|
||||||
New_file(Directory &dir, Directory::Path const &path)
|
New_file(Directory &dir, Directory::Path const &path, bool append = false)
|
||||||
:
|
:
|
||||||
_ep(dir._ep), _alloc(dir._alloc), _fs(dir._fs),
|
_ep(dir._ep), _alloc(dir._alloc), _fs(dir._fs),
|
||||||
_handle(_init_handle(dir, path))
|
_handle(_init_handle(dir, path, append))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~New_file()
|
~New_file()
|
||||||
|
|||||||
Reference in New Issue
Block a user