]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-04 Robert Millan <rmh.grub@aybabtu.com>
authorRobert Millan <rmh@aybabtu.com>
Mon, 4 Jan 2010 22:47:30 +0000 (22:47 +0000)
committerRobert Millan <rmh@aybabtu.com>
Mon, 4 Jan 2010 22:47:30 +0000 (22:47 +0000)
* 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.

commands/crc.c
fs/iso9660.c

index dff9fd55ccbeae3228f07140d362d474fe4ce7a1..1c1a690aab85febbb4c1ec739715242ea7592183 100644 (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;
 }
 
index 0647ca8fc9dd5d6dc707abfd0fbb579204fb5188..1ab98be3fd575a2ddc9c071cf61c7deb7a0ad2c8 100644 (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;
 }