[CHKDSK][VFATLIB] Chkdsk improve code (#8857)

CORE-20546

Avoid second "lseek" if we do not have "use_read" and do not need to do read alignment.
This commit is contained in:
Doug Lyons
2026-04-14 16:02:19 -05:00
committed by GitHub
parent 5a4823b5f7
commit 7ee14831a1
+3 -3
View File
@@ -373,10 +373,10 @@ void fs_write(off_t pos, int size, void *data)
/* Patch data in memory */
memcpy((char *)scratch + seek_delta, data, size);
}
/* Seek back to the beginning of our read/write */
if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",seekpos_aligned);
/* Seek back to the beginning of our read */
if (lseek(fd, seekpos_aligned, 0) != seekpos_aligned) pdie("Seek to %lld",seekpos_aligned);
}
/* Write it back */
if ((did = write(fd, scratch, readsize_aligned)) == (int)readsize_aligned)