mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-16 05:58:49 +00:00
semihosting: create file in smh_fs_write_at()
If a file does not exist, it should be created.
Fixes: f676b45151
("fs: Add semihosting filesystem")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
719120392f
commit
2f9943beb3
1 changed files with 4 additions and 0 deletions
|
@ -57,7 +57,11 @@ static int smh_fs_write_at(const char *filename, loff_t pos, void *buffer,
|
||||||
{
|
{
|
||||||
long fd, size, ret;
|
long fd, size, ret;
|
||||||
|
|
||||||
|
/* Try to open existing file */
|
||||||
fd = smh_open(filename, MODE_READ | MODE_BINARY | MODE_PLUS);
|
fd = smh_open(filename, MODE_READ | MODE_BINARY | MODE_PLUS);
|
||||||
|
if (fd < 0)
|
||||||
|
/* Create new file */
|
||||||
|
fd = smh_open(filename, MODE_WRITE | MODE_BINARY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
ret = smh_seek(fd, pos);
|
ret = smh_seek(fd, pos);
|
||||||
|
|
Loading…
Add table
Reference in a new issue