apps/examples/userfs: Handle the O_TRUNC open flag.

This commit is contained in:
Gregory Nutt 2017-11-06 07:15:20 -06:00
parent 3dd64af3db
commit 7a0d29fc59

View File

@ -233,6 +233,11 @@ static int ufstest_open(FAR void *volinfo, FAR const char *relpath,
return -ENOMEM;
}
if ((oflags & O_TRUNC) != 0)
{
file->inuse = 0;
}
if ((oflags & (O_WROK | O_APPEND)) == (O_WROK | O_APPEND))
{
opriv->pos = file->inuse;