SPRESENSE opened a new pull request, #16518: URL: https://github.com/apache/nuttx/pull/16518
## Summary When writing to the next sector after the forward position has been written by seek, the old sector buffer is used, which may corrupt the file system. Therefore, the sector buffer must always be updated after a writing by seek. ## Impact smarfs file system when CONFIG_SMARTFS_USE_SECTOR_BUFFER=y ## Testing * Simple test case ```c int main(int argc, FAR char *argv[]) { FILE *fp; uint8_t buf[5]; uint8_t val = 0x55; memset(buf, 0xaa, sizeof(buf)); fp = fopen("test.txt", "wb"); fwrite(&buf, 1, 4, fp); /* [aa aa aa aa] */ fseek(fp, 0, SEEK_SET); fwrite(&val, 1, 1, fp); /* [55 aa aa aa] */ fseek(fp, 0, SEEK_END); fwrite(&val, 1, 1, fp); /* [55 aa aa aa 55] */ fclose(fp); fp = fopen("test.txt", "rb"); fread(&buf, 1, sizeof(buf), fp); fclose(fp); printf("buf[] = [%02x %02x %02x %02x %02x]\n", buf[0], buf[1], buf[2], buf[3], buf[4]); return 0; } ``` * Result: Expected output: [55 aa aa aa 55] * Before commit: [aa aa aa aa 55] -> Fail * After commit: [55 aa aa aa 55] -> Pass -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org