4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-19 14:23:30 +08:00

[DFS] Fix file size issue

This issue causes fstat & lseek not correct.
This commit is contained in:
bernard 2014-02-01 21:35:23 +08:00
parent 5a6ec7dcae
commit 201d11bb2f

View File

@ -678,7 +678,9 @@ int nfs_write(struct dfs_fd *file, const void *buf, rt_size_t count)
total += bytes; total += bytes;
/* update current position */ /* update current position */
file->pos = fd->offset; file->pos = fd->offset;
/* todo: update file size */ /* update file size */
if (fd->size < fd->offset) fd->size = fd->offset;
file->size = fd->size;
} }
xdr_free((xdrproc_t)xdr_WRITE3res, (char *)&res); xdr_free((xdrproc_t)xdr_WRITE3res, (char *)&res);
} while (count > 0); } while (count > 0);
@ -796,6 +798,7 @@ int nfs_open(struct dfs_fd *file)
/* set private file */ /* set private file */
file->data = fp; file->data = fp;
file->size = fp->size;
} }
return 0; return 0;