Correction to commit 86261b7
: Sector bitmaps could not be read any more
This commit is contained in:
parent
abf4375b63
commit
ccb29eae32
@ -293,11 +293,12 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
|
|||||||
off_t sectors, sector_size;
|
off_t sectors, sector_size;
|
||||||
ssize_t i, map_size;
|
ssize_t i, map_size;
|
||||||
unsigned char *map;
|
unsigned char *map;
|
||||||
unsigned char *buf;
|
unsigned char *buf, buf_head[26];
|
||||||
|
|
||||||
buf= TSOB_FELD(unsigned char, bufsize);
|
buf= TSOB_FELD(unsigned char, bufsize);
|
||||||
if(buf == NULL)
|
if(buf == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
buf_head[0]= 0;
|
||||||
|
|
||||||
*os_errno= 0;
|
*os_errno= 0;
|
||||||
if(msg != NULL)
|
if(msg != NULL)
|
||||||
@ -322,10 +323,12 @@ wrong_filetype:;
|
|||||||
}
|
}
|
||||||
ret= 0; goto ex;
|
ret= 0; goto ex;
|
||||||
}
|
}
|
||||||
if(strncmp((char *) buf, "xorriso sector bitmap v1 ", 32) == 0)
|
if(strncmp((char *) buf, "xorriso sector bitmap v1 ", 32) == 0) {
|
||||||
/* ok */;
|
memcpy(buf_head, buf, 25);
|
||||||
else if(strncmp((char *) buf, "xorriso sector bitmap v2 ", 25) == 0 ||
|
} else if(strncmp((char *) buf, "xorriso sector bitmap v2 ", 25) == 0 ||
|
||||||
strncmp((char *) buf, "xorriso sector bitmap v3 ", 25) == 0) {
|
strncmp((char *) buf, "xorriso sector bitmap v3 ", 25) == 0) {
|
||||||
|
memcpy(buf_head, buf, 25);
|
||||||
|
buf_head[25]= 0;
|
||||||
skip= -1;
|
skip= -1;
|
||||||
sscanf(((char *) buf) + 25, "%d", &skip);
|
sscanf(((char *) buf) + 25, "%d", &skip);
|
||||||
if(skip < 0)
|
if(skip < 0)
|
||||||
@ -340,7 +343,8 @@ wrong_filetype:;
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{ret= 0; goto wrong_filetype;}
|
{ret= 0; goto wrong_filetype;}
|
||||||
if(strncmp((char *) buf, "xorriso sector bitmap v2 ", 25) == 0) {
|
if(strncmp((char *) buf_head, "xorriso sector bitmap v1 ", 25) == 0 ||
|
||||||
|
strncmp((char *) buf_head, "xorriso sector bitmap v2 ", 25) == 0) {
|
||||||
ret= read(fd, buf, 8);
|
ret= read(fd, buf, 8);
|
||||||
if(ret < 8)
|
if(ret < 8)
|
||||||
goto wrong_filetype;
|
goto wrong_filetype;
|
||||||
@ -354,13 +358,12 @@ wrong_filetype:;
|
|||||||
goto wrong_filetype;
|
goto wrong_filetype;
|
||||||
if((buf[0] & 128) || (buf[8] & 128))
|
if((buf[0] & 128) || (buf[8] & 128))
|
||||||
goto wrong_filetype;
|
goto wrong_filetype;
|
||||||
/* (My compiler hates off_t = 1 << 32. So i do it by multiplication) */
|
sectors= ((off_t) buf[0] << 56) | ((off_t) buf[1] << 48) |
|
||||||
sectors= ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]) *
|
((off_t) buf[2] << 40) | ((off_t) buf[3] << 32) |
|
||||||
(off_t) 0x100000000;
|
(buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
|
||||||
sectors|= (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
|
sector_size= ((off_t) buf[8] << 56) | ((off_t) buf[9] << 48) |
|
||||||
sector_size= ((buf[8] << 24) | (buf[9] << 16) | (buf[10] << 8) | buf[11]) *
|
((off_t) buf[10] << 40) | ((off_t) buf[11] << 32) |
|
||||||
(off_t) 0x100000000;
|
(buf[12] << 24) | (buf[13] << 16) | (buf[14] << 8) | buf[15];
|
||||||
sector_size|= (buf[12] << 24) | (buf[13] << 16) | (buf[14] << 8) | buf[15];
|
|
||||||
}
|
}
|
||||||
ret= Sectorbitmap_new(o, sectors, sector_size, 0);
|
ret= Sectorbitmap_new(o, sectors, sector_size, 0);
|
||||||
if(ret <= 0) {
|
if(ret <= 0) {
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2024.04.20.145515"
|
#define Xorriso_timestamP "2024.04.27.163443"
|
||||||
|
Loading…
Reference in New Issue
Block a user