2004-07-11 Marco Gerards <metgerards@student.han.nl>

* 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.
This commit is contained in:
marco_g 2004-07-11 14:24:54 +00:00
parent 020616c2b2
commit e15199cb7b
3 changed files with 18 additions and 8 deletions

View file

@ -1,3 +1,14 @@
2004-07-11 Marco Gerards <metgerards@student.han.nl>
* 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 <metgerards@student.han.nl> 2004-07-11 Marco Gerards <metgerards@student.han.nl>
* conf/i386-pc.rmk (pkgdata_IMAGE): Add pxeboot.img. * conf/i386-pc.rmk (pkgdata_IMAGE): Add pxeboot.img.

View file

@ -31,7 +31,7 @@ grub_partition_iterate (grub_disk_t disk,
struct grub_apple_part apart; struct grub_apple_part apart;
struct grub_disk raw; struct grub_disk raw;
int partno = 0; int partno = 0;
int pos = GRUB_DISK_SECTOR_SIZE * 2; int pos = GRUB_DISK_SECTOR_SIZE;
/* Enforce raw disk access. */ /* Enforce raw disk access. */
raw = *disk; raw = *disk;
@ -68,7 +68,7 @@ grub_partition_iterate (grub_disk_t disk,
grub_partition_t grub_partition_t
grub_partition_probe (grub_disk_t disk, const char *str) grub_partition_probe (grub_disk_t disk, const char *str)
{ {
grub_partition_t p; grub_partition_t p = 0;
int partnum = 0; int partnum = 0;
char *s = (char *) str; char *s = (char *) str;
@ -88,7 +88,7 @@ grub_partition_probe (grub_disk_t disk, const char *str)
} }
/* Get the partition number. */ /* Get the partition number. */
partnum = grub_strtoul (s, &s, 0); partnum = grub_strtoul (s, 0, 10);
if (grub_errno) if (grub_errno)
{ {
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition"); grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");

View file

@ -64,10 +64,9 @@ char *
grub_strncpy (char *dest, const char *src, int c) grub_strncpy (char *dest, const char *src, int c)
{ {
char *p = dest; char *p = dest;
int pos = 0;
while ((*p++ = *src++) != '\0' && --c)
while ((*p++ = *src++) != '\0' && c > pos) ;
pos++;
return dest; return dest;
} }
@ -285,7 +284,7 @@ grub_strtoul (const char *str, char **end, int base)
return 0; return 0;
} }
num += num * base + digit; num = num * base + digit;
str++; str++;
} }