diff --git a/examples/userfs/userfs_main.c b/examples/userfs/userfs_main.c index f53a75365..12d840a96 100644 --- a/examples/userfs/userfs_main.c +++ b/examples/userfs/userfs_main.c @@ -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;