grub/grub-core/osdep
Colin Watson 62daa27056 util: Detect more I/O errors
Many of GRUB's utilities don't check anywhere near all the possible
write errors.  For example, if grub-install runs out of space when
copying a file, it won't notice.  There were missing checks for the
return values of write, fflush, fsync, and close (or the equivalents on
other OSes), all of which must be checked.

I tried to be consistent with the existing logging practices of the
various hostdisk implementations, but they weren't entirely consistent
to start with so I used my judgement.  The result at least looks
reasonable on GNU/Linux when I provoke a write error:

  Installing for x86_64-efi platform.
  grub-install: error: cannot copy `/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed' to `/boot/efi/EFI/debian/grubx64.efi': No space left on device.

There are more missing checks in other utilities, but this should fix
the most critical ones.

Fixes Debian bug #922741.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Steve McIntyre <93sam@debian.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-03-05 10:23:47 +01:00
..
apple Make newly-created files other than grub.cfg world-readable. 2013-12-24 17:36:10 +01:00
aros util: Detect more I/O errors 2019-03-05 10:23:47 +01:00
basic grub-install: Check for arm-efi as a default target 2019-02-26 15:25:13 +01:00
bsd Make newly-created files other than grub.cfg world-readable. 2013-12-24 17:36:10 +01:00
devmapper fix detection of non-LUKS CRYPT 2016-11-05 15:28:50 +03:00
freebsd osdep/freebsd: Fix partition calculation for EBR entries 2019-03-05 10:21:54 +01:00
generic generic/blocklist: Fix implicit declaration of function grub_file_filter_disable_compression() 2018-11-21 14:45:33 +01:00
haiku haiku/getroot.c (grub_util_find_partition_start_os): Avoid division by zero. 2015-01-21 17:42:15 +01:00
hurd Clarify several translatable messages. 2013-12-21 01:41:16 +01:00
linux grub-install: Check for arm-efi as a default target 2019-02-26 15:25:13 +01:00
sun Move stat () and device mode checking into OS-dependent files as 2013-10-19 16:29:20 +02:00
unix util: Detect more I/O errors 2019-03-05 10:23:47 +01:00
windows util: Detect more I/O errors 2019-03-05 10:23:47 +01:00
blocklist.c Split out blocklist retrieving from setup.c to 2013-10-15 17:02:26 +02:00
compress.c Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir 2013-11-16 20:21:16 +01:00
config.c Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir 2013-11-16 20:21:16 +01:00
cputime.c Move cpu time retrieval to separate grub_util_get_cpu_time_ms 2013-10-15 13:13:53 +02:00
dl.c Move OS-dependent mprotect for module loading to grub-core/osdep/*/dl.c 2013-12-08 18:08:23 +01:00
emuconsole.c * grub-core/osdep/windows/emuconsole.c: New file. 2013-10-14 21:33:55 +02:00
emunet.c * grub-core/net/drivers/emu/emunet.c: Move to .. 2013-10-08 18:42:46 +02:00
exec.c * grub-core/osdep/exec.c: Use unix version on cygwin. 2013-12-14 21:39:03 +01:00
getroot.c Add haiku-specific functions. 2013-10-19 16:39:38 +02:00
hostdisk.c Add haiku-specific functions. 2013-10-19 16:39:38 +02:00
init.c Move set_program_name and init_nls to host_init. On windows 2013-10-13 20:03:42 +02:00
ofpath.c * util/ieee1275/ofpath.c: Move to ... 2013-10-08 18:25:49 +02:00
password.c Move password-querying (util-version) routines to grub-core/osdep. 2013-10-08 17:51:39 +02:00
platform.c Implement windows flavour of EFI install routines. 2013-12-14 23:35:58 +01:00
platform_unix.c Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir 2013-11-16 20:21:16 +01:00
random.c * grub-core/osdep/random.c: Use unix/random.c on haiku. Haiku uses 2013-10-19 02:30:05 +02:00
relpath.c Split make_system_path_relative_to_its_root into separate file 2013-10-19 16:21:08 +02:00
sleep.c Move sleep routines to grub-core/osdep. 2013-10-08 17:38:46 +02:00