2009-12-20 Robert Millan <rmh.grub@aybabtu.com>

* commands/loadenv.c (check_blocklists): Use `grub_err_t' as
	return value (and revert all return statements).  Update users.
This commit is contained in:
Robert Millan 2010-01-20 02:43:19 +00:00
parent 917dd37040
commit c893cc87fc
2 changed files with 13 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2009-12-20 Robert Millan <rmh.grub@aybabtu.com>
* commands/loadenv.c (check_blocklists): Use `grub_err_t' as
return value (and revert all return statements). Update users.
2010-01-20 Dan Merillat <debian@dan.merillat.org>
* kern/device.c (grub_device_iterate): Allocate new part_ent

View file

@ -1,7 +1,7 @@
/* loadenv.c - command to load/save environment variable. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -196,7 +196,7 @@ free_blocklists (struct blocklist *p)
}
}
static int
static grub_err_t
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
grub_file_t file)
{
@ -219,8 +219,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
{
/* This might be actually valid, but it is unbelievable that
any filesystem makes such a silly allocation. */
grub_error (GRUB_ERR_BAD_FS, "malformed file");
return 0;
return grub_error (GRUB_ERR_BAD_FS, "malformed file");
}
}
@ -230,8 +229,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
if (total_length != grub_file_size (file))
{
/* Maybe sparse, unallocated sectors. No way in GRUB. */
grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
return 0;
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
}
/* One more sanity check. Re-read all sectors by blocklists, and compare
@ -249,16 +247,13 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
if (grub_disk_read (disk, p->sector - part_start,
p->offset, p->length, blockbuf))
return 0;
return grub_errno;
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
{
grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
return 0;
}
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
}
return 1;
return GRUB_ERR_NONE;
}
static int
@ -347,7 +342,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
if (! envblk)
goto fail;
if (! check_blocklists (envblk, head, file))
if (check_blocklists (envblk, head, file))
goto fail;
while (argc)