Commit 327c8160 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Small bug fix to non-frisbee version. We don't run it very often.

parent d8ed2605
...@@ -226,6 +226,7 @@ inflate_subblock(void) ...@@ -226,6 +226,7 @@ inflate_subblock(void)
struct blockhdr *blockhdr; struct blockhdr *blockhdr;
struct region *curregion; struct region *curregion;
off_t offset, size; off_t offset, size;
char blockbuf[DEFAULTREGIONSIZE], *bbuf = blockbuf;
char *buf = inbuf; char *buf = inbuf;
d_stream.zalloc = (alloc_func)0; d_stream.zalloc = (alloc_func)0;
...@@ -243,9 +244,9 @@ inflate_subblock(void) ...@@ -243,9 +244,9 @@ inflate_subblock(void)
* image size and the magic number. * image size and the magic number.
*/ */
#ifdef FRISBEE #ifdef FRISBEE
if ((cc = FrisbeeRead(&buf, DEFAULTREGIONSIZE)) <= 0) { if ((cc = FrisbeeRead(&bbuf, DEFAULTREGIONSIZE)) <= 0) {
#else #else
if ((cc = read(infd, buf, DEFAULTREGIONSIZE)) <= 0) { if ((cc = read(infd, bbuf, DEFAULTREGIONSIZE)) <= 0) {
#endif #endif
if (cc == 0) if (cc == 0)
return 1; return 1;
...@@ -253,7 +254,7 @@ inflate_subblock(void) ...@@ -253,7 +254,7 @@ inflate_subblock(void)
exit(1); exit(1);
} }
assert(cc == DEFAULTREGIONSIZE); assert(cc == DEFAULTREGIONSIZE);
blockhdr = (struct blockhdr *) buf; blockhdr = (struct blockhdr *) bbuf;
if (blockhdr->magic != COMPRESSED_MAGIC) { if (blockhdr->magic != COMPRESSED_MAGIC) {
fprintf(stderr, "Bad Magic Number!\n"); fprintf(stderr, "Bad Magic Number!\n");
...@@ -274,11 +275,13 @@ inflate_subblock(void) ...@@ -274,11 +275,13 @@ inflate_subblock(void)
* Set the output pointer to the beginning of the region. * Set the output pointer to the beginning of the region.
*/ */
if (doseek) { if (doseek) {
if (devlseek(outfd, offset, SEEK_SET) < 0) { if (devlseek(outfd,
offset + (((off_t) outputminsec) * SECSIZE),
SEEK_SET) < 0) {
perror("Skipping to start of output region"); perror("Skipping to start of output region");
exit(1); exit(1);
} }
total += offset - total; total += offset - total;
} }
else { else {
assert(offset > total); assert(offset > total);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment