Allows to analyze information inside file, not at beginning

This commit is contained in:
Laurent Vivier 2006-09-20 21:49:51 +00:00
parent 8a3f83c256
commit b772a2238a

View File

@ -31,6 +31,11 @@ int emile_first_set_param_scsi(int fd, char *second_name)
unsigned short *block_size = (unsigned short*)&first[1014];
unsigned short *count;
unsigned long *offset;
off_t location;
location = lseek(fd, 0, SEEK_CUR);
if (location == -1)
return EEMILE_CANNOT_READ_FIRST;
ret = read(fd, first, 1024);
if (ret == -1)
@ -77,7 +82,7 @@ int emile_first_set_param_scsi(int fd, char *second_name)
/* set second level size */
(*second_size) *= BLOCK_SIZE;
ret = lseek(fd, 0, SEEK_SET);
ret = lseek(fd, location, SEEK_SET);
if (ret != 0)
return EEMILE_CANNOT_WRITE_FIRST;