diff options
author | Michal Soltys <soltys@ziu.info> | 2010-08-17 11:09:45 +0200 |
---|---|---|
committer | Michal Soltys <soltys@ziu.info> | 2010-08-22 23:45:15 +0200 |
commit | 2b3522cb5f3aa32e0377510f029c23e16ae68328 (patch) | |
tree | 97b4f10d93ebe640f905c643c2bb78b6082f499f | |
parent | d4d713c9ccfe08bf5e129a398d4f2a313b7ffe62 (diff) | |
download | syslinux-2b3522cb5f3aa32e0377510f029c23e16ae68328.tar.gz syslinux-2b3522cb5f3aa32e0377510f029c23e16ae68328.tar.xz syslinux-2b3522cb5f3aa32e0377510f029c23e16ae68328.zip |
chain, partiter: bugfixes
Signed-off-by: Michal Soltys <soltys@ziu.info>
-rw-r--r-- | com32/chain/Makefile | 4 | ||||
-rw-r--r-- | com32/chain/chain.c | 12 | ||||
-rw-r--r-- | com32/chain/partiter.c | 10 |
3 files changed, 20 insertions, 6 deletions
diff --git a/com32/chain/Makefile b/com32/chain/Makefile index 1c2b1889..337775c7 100644 --- a/com32/chain/Makefile +++ b/com32/chain/Makefile @@ -16,7 +16,7 @@ topdir = ../.. include ../MCONFIG OBJS = chain.o partiter.o -GCCWARN2 = -Wextra -Wconversion -pedantic -Wno-error +GCCEXTRA = -Wextra -Wconversion -pedantic -Wno-error -DDEBUG all: chain.c32 @@ -24,7 +24,7 @@ chain.elf: $(OBJS) $(LIBS) $(C_LIBS) $(LD) $(LDFLAGS) -o $@ $^ %.o: %.c - $(CC) $(MAKEDEPS) $(CFLAGS) $(GCCWARN2) -c -o $@ $< + $(CC) $(MAKEDEPS) $(CFLAGS) $(GCCEXTRA) -c -o $@ $< tidy dist: rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp diff --git a/com32/chain/chain.c b/com32/chain/chain.c index 6c11a4d1..9c73291d 100644 --- a/com32/chain/chain.c +++ b/com32/chain/chain.c @@ -697,6 +697,10 @@ int find_dp(struct part_iter **_iter) if (iter->index == partition) break; } while (pi_next(&iter)); + if (!iter) { + error("Requested disk / partition combination not found.\n"); + goto bail; + } } if (!(iter->di.disk & 0x80) && iter->index) { @@ -1118,6 +1122,7 @@ int main(int argc, char *argv[]) data[ndata].data = (void *)hand_area; ndata++; opt.regs.esi.w[0] = 0x7be; + #ifdef DEBUG dprintf("MBR handover:\n"); disk_dos_part_dump(hand_area); @@ -1125,6 +1130,13 @@ int main(int argc, char *argv[]) } } +#ifdef DEBUG + printf("iter dsk: %d\n", iter->di.disk); + printf("iter idx: %d\n", iter->index); + printf("iter lba: %llu\n", iter->start_lba); + if (hand_area) + printf("hand lba: %u\n", hand_area->start_lba); +#endif do_boot(data, ndata); bail: diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c index 9de72f70..43ea4156 100644 --- a/com32/chain/partiter.c +++ b/com32/chain/partiter.c @@ -355,8 +355,10 @@ static int pi_dos_next_mbr(struct part_iter *iter, uint32_t *lba, break; } + /* safe */ *lba = dp->start_lba; *_dp = dp; + return 0; } @@ -722,12 +724,12 @@ struct part_iter *pi_begin(const struct disk_info *di) goto raw; } /* allocate iterator and exit */ - if (!(iter = pi_new(typegpt, di, gpth, gptl))) - goto out; + iter = pi_new(typegpt, di, gpth, gptl); + goto out; } else { /* looks like MBR */ - if (!(iter = pi_new(typedos, di, mbr))) - goto out; + iter = pi_new(typedos, di, mbr); + goto out; } raw: |