Skip to content

Commit 3f4a7e3

Browse files
committed
[CHKDSK][VFATLIB] Chkdsk, fix writes to wrong disk offsets
1 parent 56481e1 commit 3f4a7e3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • sdk/lib/fslib/vfatlib/check

sdk/lib/fslib/vfatlib/check/io.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ void fs_write(off_t pos, int size, void *data)
374374
memcpy((char *)scratch + seek_delta, data, size);
375375
}
376376

377+
/* Seek back to the beginning of our read/write */
378+
if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",seekpos_aligned);
379+
377380
/* Write it back */
378381
if ((did = write(fd, scratch, readsize_aligned)) == (int)readsize_aligned)
379382
{

0 commit comments

Comments
 (0)