diff --git a/ChangeLog b/ChangeLog index 081386a80..36c3c5e76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-07-11 Marco Gerards + + * disk/powerpc/ieee1275/partition.c (grub_partition_iterate): Skip + one block instead of two when looking for the initial partition. + (grub_partition_probe): Initialize the local variable `p' with 0. + Use base 10 for the grub_strtoul call. + * kern/misc.c (grub_strncpy): Fix off by one bug. Eliminated the + need for one local variable. + (grub_strtoul): Don't add the new value to `num', instead of that + just assign it. + 2004-07-11 Marco Gerards * conf/i386-pc.rmk (pkgdata_IMAGE): Add pxeboot.img. diff --git a/disk/powerpc/ieee1275/partition.c b/disk/powerpc/ieee1275/partition.c index 0a48a8412..9664bf00e 100644 --- a/disk/powerpc/ieee1275/partition.c +++ b/disk/powerpc/ieee1275/partition.c @@ -31,7 +31,7 @@ grub_partition_iterate (grub_disk_t disk, struct grub_apple_part apart; struct grub_disk raw; int partno = 0; - int pos = GRUB_DISK_SECTOR_SIZE * 2; + int pos = GRUB_DISK_SECTOR_SIZE; /* Enforce raw disk access. */ raw = *disk; @@ -68,7 +68,7 @@ grub_partition_iterate (grub_disk_t disk, grub_partition_t grub_partition_probe (grub_disk_t disk, const char *str) { - grub_partition_t p; + grub_partition_t p = 0; int partnum = 0; char *s = (char *) str; @@ -88,7 +88,7 @@ grub_partition_probe (grub_disk_t disk, const char *str) } /* Get the partition number. */ - partnum = grub_strtoul (s, &s, 0); + partnum = grub_strtoul (s, 0, 10); if (grub_errno) { grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition"); diff --git a/kern/misc.c b/kern/misc.c index 8fe9913a3..28a6b63a6 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -64,10 +64,9 @@ char * grub_strncpy (char *dest, const char *src, int c) { char *p = dest; - int pos = 0; - - while ((*p++ = *src++) != '\0' && c > pos) - pos++; + + while ((*p++ = *src++) != '\0' && --c) + ; return dest; } @@ -285,7 +284,7 @@ grub_strtoul (const char *str, char **end, int base) return 0; } - num += num * base + digit; + num = num * base + digit; str++; }