/* 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
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;
}
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
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;
}