Corrected a bug in make_isohybrid_mbr()

This commit is contained in:
Thomas Schmitt 2008-10-19 07:06:49 +00:00
parent fcd0399831
commit d7bbca0ad8
1 changed files with 21 additions and 1 deletions

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.
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
@ -158,12 +158,17 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
gettimeofday(&tv, &tz);
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.
*/
lsb_to_buf(&wpt, id, 32, 0);
lsb_to_buf(&wpt, 0, 16, 0);
/*
129: Composes 16 byte record from the parameters determined
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)
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);
}