On 12/15/05 09:09, Dave Anderson wrote:
I don't think that the "else" part is required since
lkcd_offset_to_first_page
is statically initialized to LKCD_OFFSET_TO_FIRST_PAGE above. But
for readability this looks fine to me.
It's not the initialization that's the problem, it's the unconditional
assignment of dh_dump_buffer_size in hunk 2 of the patch. That
assignment has to be conditional on the dump version.
Troy
> --- lkcd_v8.c.ori 2005-12-08 14:53:07.026719000 -0700
> +++ lkcd_v8.c 2005-12-14 14:52:40.086407560 -0700
> @@ -57,10 +57,13 @@
> if (read(lkcd->fd, dh, sizeof(dump_header_t)) !=
> sizeof(dump_header_t))
> return FALSE;
> - if ((dh->dh_version & LKCD_DUMP_VERSION_NUMBER_MASK) ==
LKCD_DUMP_V9)
> + if ((dh->dh_version & LKCD_DUMP_VERSION_NUMBER_MASK) ==
LKCD_DUMP_V9){
> if (read(lkcd->fd, &dh_dump_buffer_size,
sizeof(dh_dump_buffer_size)) !=
> sizeof(dh_dump_buffer_size))
> return FALSE;
> + lkcd_offset_to_first_page = dh_dump_buffer_size;
> + } else
> + lkcd_offset_to_first_page = LKCD_OFFSET_TO_FIRST_PAGE;
>
> lkcd->dump_page = dp;
> lkcd->dump_header = dh;
> @@ -147,7 +150,6 @@
> lkcd->compression = dh->dh_dump_compress;
> lkcd->page_header_size = sizeof(dump_page_t);
>
> - lkcd_offset_to_first_page = dh_dump_buffer_size;
> lseek(lkcd->fd, lkcd_offset_to_first_page, SEEK_SET);
>
> /*