Improve gettext support. Stylistic fixes and error handling fixes while
on it.
This commit is contained in:
parent
215c90cb82
commit
9c4b5c13e6
184 changed files with 1175 additions and 959 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Platforms where modules are in a readonly area of memory. */
|
||||
#if defined(GRUB_MACHINE_QEMU)
|
||||
|
@ -208,20 +209,24 @@ static grub_err_t
|
|||
grub_dl_check_header (void *ehdr, grub_size_t size)
|
||||
{
|
||||
Elf_Ehdr *e = ehdr;
|
||||
grub_err_t err;
|
||||
|
||||
/* Check the header size. */
|
||||
if (size < sizeof (Elf_Ehdr))
|
||||
return grub_error (GRUB_ERR_BAD_OS, "ELF header smaller than expected");
|
||||
|
||||
/* Check the magic numbers. */
|
||||
if (grub_arch_dl_check_header (ehdr)
|
||||
|| e->e_ident[EI_MAG0] != ELFMAG0
|
||||
if (e->e_ident[EI_MAG0] != ELFMAG0
|
||||
|| e->e_ident[EI_MAG1] != ELFMAG1
|
||||
|| e->e_ident[EI_MAG2] != ELFMAG2
|
||||
|| e->e_ident[EI_MAG3] != ELFMAG3
|
||||
|| e->e_ident[EI_VERSION] != EV_CURRENT
|
||||
|| e->e_version != EV_CURRENT)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch independent ELF magic");
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch independent ELF magic"));
|
||||
|
||||
err = grub_arch_dl_check_header (ehdr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -345,7 +350,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symbol table");
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
||||
|
||||
#ifdef GRUB_MODULES_MACHINE_READONLY
|
||||
mod->symtab = grub_malloc (s->sh_size);
|
||||
|
@ -378,7 +383,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||
grub_symbol_t nsym = grub_dl_resolve_symbol (name);
|
||||
if (! nsym)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"symbol not found: `%s'", name);
|
||||
N_("symbol `%s' not found"), name);
|
||||
sym->st_value = (Elf_Addr) nsym->addr;
|
||||
if (nsym->isfunc)
|
||||
sym->st_info = ELF_ST_INFO (bind, STT_FUNC);
|
||||
|
@ -596,7 +601,7 @@ grub_dl_load_core (void *addr, grub_size_t size)
|
|||
|
||||
if (e->e_type != ET_REL)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF file type");
|
||||
grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -704,7 +709,7 @@ grub_dl_load (const char *name)
|
|||
return mod;
|
||||
|
||||
if (! grub_dl_dir) {
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "\"prefix\" is not set");
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue