summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 20:55:07 +0300
committerSimon Glass <sjg@chromium.org>2018-10-09 13:40:26 +0300
commit50b288aca324649fb5b357ce75972a5261cf94fc (patch)
tree7684005feef776fa06fc966d5ec8b72c29232869 /arch
parentcdd140af5c6b623d31ac87a8054cee55fb70d3f0 (diff)
downloadu-boot-50b288aca324649fb5b357ce75972a5261cf94fc.tar.xz
sandbox: Support file truncation with os_open()
At present files are not truncated on writing. This is a useful feature. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/cpu/os.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index d4d6d78dc7..1d87a53843 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -85,6 +85,8 @@ int os_open(const char *pathname, int os_flags)
if (os_flags & OS_O_CREAT)
flags |= O_CREAT;
+ if (os_flags & OS_O_TRUNC)
+ flags |= O_TRUNC;
return open(pathname, flags, 0777);
}