guohao15 opened a new pull request, #13098: URL: https://github.com/apache/nuttx/pull/13098
## Summary When using lseek with SEEK_SET and the offset is greater than the file's size, the space between size and offset should be filled with \0. However, in tmpfs, it will be filled with old data. Reproduction: fd = open(argv[1], O_WRONLY|O_CREAT, 0666); ret = write(fd, "hello\n", 6); // Write initial data close(fd); fd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC, 0666); // Here the filesize will be overwritten to 0 ret = lseek(fd, 50, SEEK_SET); ret = write(fd, "world\n", 6); // Write new data close(fd); Correct result: world Incorrect result: hello world ## Impact ## Testing -- 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]
