Corrected a bug in make_isohybrid_mbr()

This commit is contained in:
Thomas Schmitt 2008-10-19 07:06:49 +00:00
parent 4110cfca00
commit b52c2da23a

View File

@ -108,7 +108,7 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
84: Gets size of image in bytes. 84: Gets size of image in bytes.
89: 89:
*/ */
imgsize= ((off_t) img_blocks) * (off_t) 2048; imgsize= ((off_t) *img_blocks) * (off_t) 2048;
/* /*
90: Computes $padding, size of padded image and number $c of 90: Computes $padding, size of padded image and number $c of
@ -158,12 +158,17 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
gettimeofday(&tv, &tz); gettimeofday(&tv, &tz);
id= 0xffffffff & (tv.tv_sec ^ (tv.tv_usec * 2000)); id= 0xffffffff & (tv.tv_sec ^ (tv.tv_usec * 2000));
/* <<< for comparison with the perl script only
id= 1234567890;
*/
/* /*
126: Adds 4 id bytes and 2 zero bytes. 126: Adds 4 id bytes and 2 zero bytes.
*/ */
lsb_to_buf(&wpt, id, 32, 0); lsb_to_buf(&wpt, id, 32, 0);
lsb_to_buf(&wpt, 0, 16, 0); lsb_to_buf(&wpt, 0, 16, 0);
/* /*
129: Composes 16 byte record from the parameters determined 129: Composes 16 byte record from the parameters determined
147: so far. Appends it to buffer and add 48 zero bytes. 147: so far. Appends it to buffer and add 48 zero bytes.
@ -224,6 +229,21 @@ int main(int argc, char **argv)
if(ret <= 0) if(ret <= 0)
exit(1); exit(1);
/* <<< for comparison with the perl script only
{
FILE *fp;
fp= fopen("/u/test/mbr_make_isohybrid_mbr", "w");
if(fp == NULL) {
perror("make_isohybrid_mbr");
exit(2);
}
fwrite(mbr, 512, 1, fp);
fclose(fp);
}
*/
exit(0); exit(0);
} }