I think there's a bug in the implementation of fat_lseek in pfs_fat.c:171, where the pos argument is not used, but the integer values of the flags SEEK_CUR and SEEK_END are added to the offset instead:
STATIC long fat_lseek (struct pfs_file *pfs_fd, long pos, int whence)
{
struct fat_file *fd = (struct fat_file *) pfs_fd;
switch (whence)
{
case SEEK_CUR: whence += f_tell (&fd->fil); break;
case SEEK_END: whence += f_size (&fd->fil); break;
}
FRESULT r = f_lseek (&fd->fil, whence);
return ( r == FR_OK ) ? f_tell (&fd->fil) : fat_error (r);
}
I think there's a bug in the implementation of
fat_lseek
in pfs_fat.c:171, where thepos
argument is not used, but the integer values of the flagsSEEK_CUR
andSEEK_END
are added to the offset instead: