2010-01-04 Robert Millan <rmh.grub@aybabtu.com>

* commands/crc.c (grub_cmd_crc): Abort on read errors.
	* fs/iso9660.c (grub_iso9660_read): Check for read error and pass
	it to upper layer.
This commit is contained in:
Robert Millan 2010-01-04 22:47:30 +00:00
parent 52c2d97f26
commit 732c47f005
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* crc.c - command to calculate the crc32 checksum of a file */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,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
@ -46,10 +46,13 @@ grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
crc = grub_getcrc32 (crc, buf, size);
grub_file_close (file);
if (grub_errno)
goto fail;
grub_printf ("%08x\n", crc);
fail:
grub_file_close (file);
return 0;
}

View File

@ -2,7 +2,7 @@
SUSP, Rock Ridge. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2004,2005,2006,2007,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
@ -773,7 +773,10 @@ grub_iso9660_read (grub_file_t file, char *buf, grub_size_t len)
data->first_sector << GRUB_ISO9660_LOG2_BLKSZ,
file->offset,
len, buf);
data->disk->read_hook = 0;
data->disk->read_hook = NULL;
if (grub_errno)
return -1;
return len;
}