diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c index dd2def7457..3a32bc03d2 100644 --- a/fs/nfs/nfs_vfsops.c +++ b/fs/nfs/nfs_vfsops.c @@ -367,7 +367,7 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, FAR struct nfsnode *np, /* Save the attributes in the file data structure */ - tmp = *ptr; /* attributes_follows */ + tmp = *ptr++; /* attributes_follows */ if (!tmp) { fwarn("WARNING: no file attributes\n"); @@ -731,6 +731,15 @@ static int nfs_open(FAR struct file *filep, FAR const char *relpath, filep->f_priv = np; + /* In write/append mode, we need to set the file pointer to the end of + * the file. + */ + + if ((oflags & (O_APPEND | O_WRONLY)) == (O_APPEND | O_WRONLY)) + { + filep->f_pos = (off_t)np->n_size; + } + /* Then insert the new instance at the head of the list in the mountpoint * structure. It needs to be there (1) to handle error conditions that * effect all files, and (2) to inform the umount logic that we are busy.