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>
This commit is contained in:
Simon Glass
2018-10-01 11:55:07 -06:00
parent cdd140af5c
commit 50b288aca3
2 changed files with 3 additions and 0 deletions

View File

@@ -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);
}