mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-26 03:44:15 +01:00
reset read/write position properly on first cluster allocation
This commit is contained in:
parent
8d36ebe061
commit
ad1161c083
@ -56,6 +56,10 @@
|
|||||||
2008-05-12 - Chishm
|
2008-05-12 - Chishm
|
||||||
* Modified WinterMute's seek then write fix for elegance
|
* Modified WinterMute's seek then write fix for elegance
|
||||||
* Removed resetPosition
|
* Removed resetPosition
|
||||||
|
|
||||||
|
2008-05-12 - WinterMute
|
||||||
|
* Modified Chishm's elegant fix to reset the read/write positions
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -594,6 +598,12 @@ int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len) {
|
|||||||
file->appendPosition.cluster = file->startCluster;
|
file->appendPosition.cluster = file->startCluster;
|
||||||
file->appendPosition.sector = 0;
|
file->appendPosition.sector = 0;
|
||||||
file->appendPosition.byte = 0;
|
file->appendPosition.byte = 0;
|
||||||
|
|
||||||
|
if ( file->currentPosition < partition->bytesPerCluster ) {
|
||||||
|
file->rwPosition.cluster = file->startCluster;
|
||||||
|
file->rwPosition.sector = (file->currentPosition % partition->bytesPerCluster) / BYTES_PER_READ;
|
||||||
|
file->rwPosition.byte = file->currentPosition % BYTES_PER_READ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->append) {
|
if (file->append) {
|
||||||
|
Loading…
Reference in New Issue
Block a user