examplex/media: Need to seek back to beginning of file on second pass

This commit is contained in:
Gregory Nutt 2015-11-09 13:33:37 -06:00
parent 5fdd68f014
commit a584ef09aa

View File

@ -301,6 +301,21 @@ int media_main(int argc, char *argv[])
info.nblocks = blockno;
}
/* Seek to the beginnin of the file */
seekpos = lseek(fd, 0, SEEK_SET);
if (seekpos == (off_t)-1)
{
int errcode = errno;
fprintf(stderr, "ERROR: lseek to 0 failed: %d\n", errcode);
}
else if (seekpos != 0)
{
fprintf(stderr, "ERROR: lseek to 0 failed: %lu\n",
(unsigned)seekpos);
}
/* Re-read and verify each sector */
value = START_VALUE;