Improve and unify messages.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Add argument name. All users updated. Print filename in error. (read_device_map): Print filename in error. * util/getroot.c (grub_guess_root_devices): Print filename in error. (grub_util_get_os_disk): Likewise. (grub_util_biosdisk_get_grub_dev): Likewise. (grub_util_check_block_device): Likewise. (grub_util_check_char_device): Likewise. (grub_make_system_path_relative_to_its_root): Likewise. * util/grub-editenv.c (create_envblk_file): Likewise. (open_envblk_file): Likewise. (write_envblk): Likewise. * util/grub-fstest.c (cmd_cp): Likewise. (cmd_cat): Likewise. (cmd_cmp): Likewise. * util/grub-menulst2cfg.c (main): Likewise. * util/grub-mkfont.c (write_font_ascii_bitmap): Likewise. (write_font_width_spec): Likewise. (write_font_pf2): Likewise. * util/grub-mkimage.c (generate_image): New argument outname. All users updated. Remove unreacheable message. (options): Unify messages. (help_filter): Likewise. * util/grub-mklayout.c (usage): Removed (unused). (main): Print filename in error. * util/grub-mkrescue.in: Fix wrong quoting. * util/grub-setup.c (setup): Print filename in error. * util/ieee1275/ofpath.c (vendor_is_ATA): Likewise. (check_sas): Likewise. * util/misc.c (grub_util_get_fp_size): Removed. (grub_util_get_image_size): Print filename in error. (grub_util_read_at): Removed. (grub_util_read_image): Print filename in error. (grub_util_load_image): Likewise. (grub_util_write_image_at): New argument filename. All users updated. Print filename in error. (grub_util_write_image): New argument filename. All users updated. Print filename in error. * util/raid.c (grub_util_raid_getmembers): Print filename in error. * util/resolve.c (grub_util_resolve_dependencies): Likewise.
This commit is contained in:
parent
0a96117de7
commit
0ae70393ba
19 changed files with 222 additions and 166 deletions
|
@ -120,14 +120,16 @@ create_envblk_file (const char *name)
|
|||
namenew = xasprintf ("%s.new", name);
|
||||
fp = fopen (namenew, "wb");
|
||||
if (! fp)
|
||||
grub_util_error (_("cannot open the file %s"), namenew);
|
||||
grub_util_error (_("cannot open `%s': %s"), namenew,
|
||||
strerror (errno));
|
||||
|
||||
memcpy (buf, GRUB_ENVBLK_SIGNATURE, sizeof (GRUB_ENVBLK_SIGNATURE) - 1);
|
||||
memset (buf + sizeof (GRUB_ENVBLK_SIGNATURE) - 1, '#',
|
||||
DEFAULT_ENVBLK_SIZE - sizeof (GRUB_ENVBLK_SIGNATURE) + 1);
|
||||
|
||||
if (fwrite (buf, 1, DEFAULT_ENVBLK_SIZE, fp) != DEFAULT_ENVBLK_SIZE)
|
||||
grub_util_error (_("cannot write to the file %s"), namenew);
|
||||
grub_util_error (_("cannot write to the file `%s': %s"), namenew,
|
||||
strerror (errno));
|
||||
|
||||
fsync (fileno (fp));
|
||||
free (buf);
|
||||
|
@ -153,23 +155,27 @@ open_envblk_file (const char *name)
|
|||
create_envblk_file (name);
|
||||
fp = fopen (name, "rb");
|
||||
if (! fp)
|
||||
grub_util_error (_("cannot open the file %s"), name);
|
||||
grub_util_error (_("cannot open `%s': %s"), name,
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
if (fseek (fp, 0, SEEK_END) < 0)
|
||||
grub_util_error (_("cannot seek the file %s"), name);
|
||||
grub_util_error (_("cannot seek the file `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
size = (size_t) ftell (fp);
|
||||
|
||||
if (fseek (fp, 0, SEEK_SET) < 0)
|
||||
grub_util_error (_("cannot seek the file %s"), name);
|
||||
grub_util_error (_("cannot seek the file `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
buf = malloc (size);
|
||||
if (! buf)
|
||||
grub_util_error (_("out of memory"));
|
||||
|
||||
if (fread (buf, 1, size, fp) != size)
|
||||
grub_util_error (_("cannot read the file %s"), name);
|
||||
grub_util_error (_("cannot read the file `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
fclose (fp);
|
||||
|
||||
|
@ -204,11 +210,13 @@ write_envblk (const char *name, grub_envblk_t envblk)
|
|||
|
||||
fp = fopen (name, "wb");
|
||||
if (! fp)
|
||||
grub_util_error (_("cannot open the file %s"), name);
|
||||
grub_util_error (_("cannot open `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
if (fwrite (grub_envblk_buffer (envblk), 1, grub_envblk_size (envblk), fp)
|
||||
!= grub_envblk_size (envblk))
|
||||
grub_util_error (_("cannot write to the file %s"), name);
|
||||
grub_util_error (_("cannot write to the file `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
fsync (fileno (fp));
|
||||
fclose (fp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue