alexguirre opened a new pull request, #14528:
URL: https://github.com/apache/nuttx/pull/14528
## Summary
Fixes the following issues:
- When opening a NFS file in append mode, its file pointer was at offset 0
instead of the end of file.
- When creating a NFS file, the response read pointer wasn't advanced after
reading the attributes_follows bool, which caused the attributes to be off by 4
bytes. For example, the file size read the GID.
## Impact
NFS now has a more correct behavior, closer to other file systems.
is
## Testing
Simulator, with a NFS mount (`nsh> nfsmount 10.0.1.1 /nfs /export udp`) and
the following test program:
```c
int main(int argc, FAR char *argv[]) {
for (int i = 0; i < 5; i++) {
FILE *f = fopen("/nfs/test.txt", "a");
long start_pos = ftell(f);
fseek(f, 0, SEEK_END);
long size = ftell(f);
fseek(f, start_pos, SEEK_SET);
const char* data = "Hello World";
fwrite(data, strlen(data), 1, f);
long end_pos = ftell(f);
fclose(f);
printf("size:%ld start:%ld end:%ld\n", size, start_pos,
end_pos);
}
return 0;
}
```
Initial result:
```
size:281466386776064 start:0 end:11
size:11 start:0 end:11
size:11 start:0 end:11
size:11 start:0 end:11
size:11 start:0 end:11
```
After fix:
```
size:0 start:0 end:11
size:11 start:11 end:22
size:22 start:22 end:33
size:33 start:33 end:44
size:44 start:44 end:55
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]