Merge from trunk

This commit is contained in:
Robert Millan 2010-01-07 00:58:54 +00:00
commit c1d2f1d81b
20 changed files with 250 additions and 64 deletions

120
ChangeLog
View file

@ -1,3 +1,123 @@
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
Merge prefix-redefinition-fix branch.
* normal/autofs.c (read_fs_list): Make function capable of being
run multiple times, gracefuly replacing the previous data
structures.
* normal/dyncmd.c (read_command_list): Likewise.
* normal/handler.c (read_handler_list): Likewise.
* normal/main.c (read_lists): New function. Calls all the
list reading functions.
(grub_normal_execute): Use read_lists() instead of calling all
list reading functions explicitly. Register read_lists() as a
variable hook attached to ${prefix}.
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
Merge crypto branch.
* Makefile.in (pkglib_DATA): Add crypto.lst.
(crypto.lst): New target.
* commands/hashsum.c: New file.
* commands/password.c (check_password): Use grub_crypto_memcmp.
* commands/password_pbkdf2.c: New file.
* commands/xnu_uuid.c: Remove MD5. Use GRUB_MD_MD5.
* conf/any-emu.rmk (grub_emu_SOURCES): Add lib/crypto.c,
normal/crypto.c and lib/libgcrypt-grub/cipher/md5.c.
(grub_emu_CFLAGS): Add -Wno-missing-field-initializers -Wno-error
-I$(srcdir)/lib/libgcrypt_wrap.
* conf/common.rmk (normal_mod_SOURCES): Add normal/crypto.c.
(pkglib_MODULES): Add crypto.mod, hashsum.mod, pbkdf2.mod and
password_pbkdf2.mod.
(crypto_mod_SOURCES): New variable.
(crypto_mod_CFLAGS): Likewise.
(crypto_mod_LDFLAGS): Likewise.
(hashsum_mod_SOURCES): New variable.
(hashsum_mod_CFLAGS): Likewise.
(hashsum_mod_LDFLAGS): Likewise.
(pbkdf2_mod_SOURCES): New variable.
(pbkdf2_mod_CFLAGS): Likewise.
(pbkdf2_mod_LDFLAGS): Likewise.
(password_pbkdf2_mod_SOURCES): New variable.
(password_pbkdf2_mod_CFLAGS): Likewise.
(password_pbkdf2_mod_LDFLAGS): Likewise.
(bin_UTILITIES): Add grub-mkpasswd-pbkdf2.
(grub_mkpasswd_pbkdf2_SOURCES): New variable.
(grub_mkpasswd_pbkdf2_CFLAGS): Likewise.
Include conf/gcry.rmk.
* include/grub/auth.h: Rewritten.
* include/grub/crypto.h: New file.
* include/grub/disk.h (grub_disk_dev_id): Add GRUB_DISK_DEVICE_LUKS_ID.
* include/grub/normal.h (read_crypto_list): New prototype.
* lib/crypto.c: New file.
* lib/libgcrypt_wrap/cipher_wrap.h: Likewise.
* lib/pbkdf2.c: Likewise.
* normal/auth.c (grub_auth_strcmp): Removed.
(grub_iswordseparator): Likewise.
(grub_auth_strword): Likewise.
(is_authenticated): Use grub_strword.
(grub_auth_check_authentication): Use grub_strcmp, grub_password_get
and grub_strword. Pass entered password to authentication callback.
* normal/crypto.c: New file.
* normal/main.c: Call read_crypto_list.
* util/grub-mkpasswd-pbkdf2.c: New file.
* util/import_gcry.py: Generate crypto.lst. Add hash blocklen.
2010-01-06 Vladimir Serbinenko <phcoder@gmail.com>
Fix descent and ascent calculation.
* util/grub-mkfont.c (grub_font_info): New fields 'asce' and 'max_y'.
(options): New option "asce".
(usage): Likewise.
(add_char): Ignore invalid glyphs for descent calculation.
Calculate ascent from actual content.
(print_glyphs): Use 'asce'.
(write_font): Likewise. Allow ascent override.
(main): Handle "asce" option.
2010-01-06 Carles Pina i Estany <carles@pina.cat>
* kern/err.c: Include `<grub/i18n.h>'.
(grub_print_error): Add full stop. Gettextizze.
* loader/i386/bsd.c (grub_netbsd_boot): Change grub_error description.
(grub_bsd_load_elf): Capitalise ELF.
(grub_cmd_freebsd_loadenv): Add `s' in error string.
(grub_cmd_freebsd_module): Likewise.
(grub_cmd_freebsd_module_elf): Likewise.
* loader/i386/bsdXX.c (SUFFIX): Capitalise ELF.
2010-01-06 Carles Pina i Estany <carles@pina.cat>
* commands/search.c (GRUB_MOD_INIT): Use HELP_MESSAGE.
* commands/search_file.c (HELP_MESSAGE): New macro.
* commands/search_label.c (HELP_MESSAGE): Likewise.
* commands/search_uuid.c (HELP_MESSAGE): Likewise.
* po/POTFILES: Add `commands/search_file.c',
`commands/search_label.c', `commands_uuid.c'. Remove duplicate
`commands/search.c'.
2010-01-05 Robert Millan <rmh.grub@aybabtu.com>
* config.rpath: Update from Gnulib.
2010-01-05 Yves Blusseau <blusseau@zetam.org>
* commands/acpi.c (grub_acpi_create_ebda): fix incorrect message.
2010-01-05 Yves Blusseau <yves.blusseau@zetam.org>
* util/sparc64/ieee1275/grub-mkimage.c (main): Typo fix.
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
* util/mkisofs/write.c (padblock_write): Switch size and nmemb
arguments to fread so that we get a return value in bytes, rather
than something that will normally be rounded down to 0.
Adjust error handling to avoid producing garbage when size_t is not
the same size as long long.
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
* util/mkisofs/write.c (padblock_write): Check return value of

View file

@ -229,7 +229,7 @@ grub_acpi_create_ebda (void)
sizeof (struct grub_acpi_rsdp_v10)) == 0)
{
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10);
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);

View file

@ -166,9 +166,7 @@ GRUB_MOD_INIT(search_fs_label)
cmd =
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
N_("NAME [VARIABLE]"),
"Search devices by " SEARCH_TARGET "."
" If VARIABLE is specified, "
"the first device found is set to a variable.");
HELP_MESSAGE);
}
#ifdef DO_SEARCH_FILE

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_fs_file
#define COMMAND_NAME "search.file"
#define SEARCH_TARGET "file"
#define HELP_MESSAGE N_("Search devices by file. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_label
#define COMMAND_NAME "search.fs_label"
#define SEARCH_TARGET "filesystem label"
#define HELP_MESSAGE N_("Search devices by label. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_fs_uuid
#define COMMAND_NAME "search.fs_uuid"
#define SEARCH_TARGET "filesystem UUID"
#define HELP_MESSAGE N_("Search devices by UUID. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -31,6 +31,7 @@
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub/crypto.h>
#include <grub/i18n.h>

View file

@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2007 Free Software Foundation, Inc.
# Copyright 1996-2008 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@ -47,7 +47,7 @@ for cc_temp in $CC""; do
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
# Code taken from libtool.m4's _LT_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
@ -64,7 +64,7 @@ else
;;
esac
;;
mingw* | cygwin* | pw32* | os2*)
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
@ -76,7 +76,13 @@ else
;;
linux* | k*bsd*-gnu)
case $cc_basename in
icc* | ecc*)
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
@ -124,7 +130,7 @@ else
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
@ -132,7 +138,7 @@ hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@ -158,7 +164,7 @@ if test "$with_gnu_ld" = yes; then
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
@ -182,7 +188,7 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@ -254,7 +260,7 @@ else
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@ -264,7 +270,7 @@ else
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
@ -326,7 +332,7 @@ else
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@ -494,7 +500,7 @@ else
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
@ -505,7 +511,7 @@ case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix4* | aix5*)
aix[4-9]*)
library_names_spec='$libname$shrext'
;;
amigaos*)
@ -517,7 +523,7 @@ case "$host_os" in
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;

View file

@ -20,6 +20,7 @@
#include <grub/err.h>
#include <grub/misc.h>
#include <stdarg.h>
#include <grub/i18n.h>
#define GRUB_MAX_ERRMSG 256
#define GRUB_ERROR_STACK_SIZE 10
@ -121,7 +122,7 @@ grub_print_error (void)
do
{
if (grub_errno != GRUB_ERR_NONE)
grub_err_printf ("error: %s\n", grub_errmsg);
grub_err_printf (_("error: %s.\n"), grub_errmsg);
}
while (grub_error_pop ());

View file

@ -59,7 +59,10 @@ grub_cipher_unregister (gcry_cipher_spec_t *cipher)
gcry_cipher_spec_t **ciph;
for (ciph = &grub_ciphers; *ciph; ciph = &((*ciph)->next))
if (*ciph == cipher)
*ciph = (*ciph)->next;
{
*ciph = (*ciph)->next;
break;
}
}
void
@ -75,7 +78,10 @@ grub_md_unregister (gcry_md_spec_t *cipher)
gcry_md_spec_t **ciph;
for (ciph = &grub_digests; *ciph; ciph = &((*ciph)->next))
if (*ciph == cipher)
*ciph = (*ciph)->next;
{
*ciph = (*ciph)->next;
break;
}
}
void

View file

@ -680,7 +680,7 @@ grub_netbsd_boot (void)
+ sizeof (struct grub_netbsd_btinfo_mmap_header)
+ count * sizeof (struct grub_netbsd_btinfo_mmap_entry)
> grub_os_area_addr + grub_os_area_size)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "no memory for boot info");
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
curarg = mmap = (struct grub_netbsd_btinfo_mmap_header *) kern_end;
pm = (struct grub_netbsd_btinfo_mmap_entry *) (mmap + 1);
@ -888,7 +888,7 @@ grub_bsd_load_elf (grub_elf_t elf)
return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
}
else
return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
}
static grub_err_t
@ -1081,7 +1081,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only FreeBSD support environment");
"only FreeBSD supports environment");
if (argc == 0)
{
@ -1175,11 +1175,11 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only FreeBSD support module");
"only FreeBSD supports module");
if (!is_elf_kernel)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only ELF kernel support module");
"only ELF kernel supports module");
/* List the current modules if no parameter. */
if (!argc)
@ -1241,11 +1241,11 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only FreeBSD support module");
"only FreeBSD supports module");
if (! is_elf_kernel)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only ELF kernel support module");
"only ELF kernel supports module");
/* List the current modules if no parameter. */
if (! argc)

View file

@ -271,7 +271,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (grub_file_t file, grub_addr_t *kern_end)
(grub_ssize_t) symsize)
{
if (! grub_errno)
return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
return grub_errno;
}
curload += symsize;
@ -285,7 +285,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (grub_file_t file, grub_addr_t *kern_end)
!= (grub_ssize_t) strsize)
{
if (! grub_errno)
return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
return grub_error (GRUB_ERR_BAD_OS, "invalid ELF");
return grub_errno;
}
curload += strsize;

View file

@ -51,12 +51,6 @@ void
read_fs_list (void)
{
const char *prefix;
static int first_time = 1;
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix");
if (prefix)
@ -67,11 +61,27 @@ read_fs_list (void)
if (filename)
{
grub_file_t file;
grub_fs_autoload_hook_t tmp_autoload_hook;
grub_sprintf (filename, "%s/fs.lst", prefix);
/* This rules out the possibility that read_fs_list() is invoked
recursively when we call grub_file_open() below. */
tmp_autoload_hook = grub_fs_autoload_hook;
grub_fs_autoload_hook = NULL;
file = grub_file_open (filename);
if (file)
{
/* Override previous fs.lst. */
while (fs_module_list)
{
grub_named_list_t tmp;
tmp = fs_module_list->next;
grub_free (fs_module_list);
fs_module_list = tmp;
}
while (1)
{
char *buf;
@ -113,6 +123,7 @@ read_fs_list (void)
}
grub_file_close (file);
grub_fs_autoload_hook = tmp_autoload_hook;
}
grub_free (filename);

View file

@ -63,12 +63,6 @@ void
read_command_list (void)
{
const char *prefix;
static int first_time = 1;
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix");
if (prefix)
@ -85,6 +79,16 @@ read_command_list (void)
if (file)
{
char *buf = NULL;
/* Override previous commands.lst. */
while (grub_command_list)
{
grub_command_t tmp;
tmp = grub_command_list->next;
grub_free (grub_command_list);
grub_command_list = tmp;
}
for (;; grub_free (buf))
{
char *p, *name, *modname;

View file

@ -135,7 +135,6 @@ void
read_handler_list (void)
{
const char *prefix;
static int first_time = 1;
const char *class_name;
auto int iterate_handler (grub_handler_t handler);
@ -162,11 +161,6 @@ read_handler_list (void)
return 0;
}
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix");
if (prefix)
{
@ -182,6 +176,16 @@ read_handler_list (void)
if (file)
{
char *buf = NULL;
/* Override previous handler.lst. */
while (grub_handler_class_list)
{
grub_handler_class_t tmp;
tmp = grub_handler_class_list->next;
grub_free (grub_handler_class_list);
grub_handler_class_list = tmp;
}
for (;; grub_free (buf))
{
char *p;

View file

@ -433,6 +433,20 @@ grub_normal_init_page (struct grub_term_output *term)
grub_free (unicode_msg);
}
static int reader_nested;
static char *
read_lists (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
read_command_list ();
read_fs_list ();
read_handler_list ();
read_crypto_list ();
read_terminal_list ();
return val ? grub_strdup (val) : NULL;
}
/* Read the config file CONFIG and execute the menu interface or
the command line interface if BATCH is false. */
void
@ -440,11 +454,8 @@ grub_normal_execute (const char *config, int nested, int batch)
{
grub_menu_t menu = 0;
read_command_list ();
read_fs_list ();
read_handler_list ();
read_crypto_list ();
read_terminal_list ();
read_lists (NULL, NULL);
grub_register_variable_hook ("prefix", NULL, read_lists);
grub_command_execute ("parser.grub", 0, 0);
if (config)

View file

@ -37,7 +37,9 @@ commands/probe.c
commands/read.c
commands/reboot.c
commands/search.c
commands/search.c
commands/search_file.c
commands/search_label.c
commands/search_uuid.c
commands/sleep.c
commands/test.c
commands/true.c

View file

@ -59,10 +59,12 @@ struct grub_font_info
char* name;
int style;
int desc;
int asce;
int size;
int max_width;
int max_height;
int min_y;
int max_y;
int flags;
int num_range;
grub_uint32_t *ranges;
@ -77,6 +79,7 @@ static struct option options[] =
{"range", required_argument, 0, 'r'},
{"size", required_argument, 0, 's'},
{"desc", required_argument, 0, 'd'},
{"asce", required_argument, 0, 'c'},
{"bold", no_argument, 0, 'b'},
{"no-bitmap", no_argument, 0, 0x100},
{"no-hinting", no_argument, 0, 0x101},
@ -104,6 +107,7 @@ Usage: %s [OPTIONS] FONT_FILES\n\
-n, --name=S set font family name\n\
-s, --size=N set font size\n\
-d, --desc=N set font descent\n\
-c, --asce=N set font ascent\n\
-b, --bold convert to bold font\n\
-a, --force-autohint force autohint\n\
--no-hinting disable hinting\n\
@ -193,9 +197,12 @@ add_char (struct grub_font_info *font_info, FT_Face face,
if (height > font_info->max_height)
font_info->max_height = height;
if (glyph_info->y_ofs < font_info->min_y)
if (glyph_info->y_ofs < font_info->min_y && glyph_info->y_ofs > -font_info->size)
font_info->min_y = glyph_info->y_ofs;
if (glyph_info->y_ofs + height > font_info->max_y)
font_info->max_y = glyph_info->y_ofs + height;
mask = 0;
data = &glyph_info->bitmap[0] - 1;
for (j = 0; j < height; j++)
@ -284,8 +291,8 @@ print_glyphs (struct grub_font_info *font_info)
xmin = 0;
ymax = glyph->y_ofs + glyph->height;
if (ymax < font_info->size - font_info->desc)
ymax = font_info->size - font_info->desc;
if (ymax < font_info->asce)
ymax = font_info->asce;
ymin = glyph->y_ofs;
if (ymin > - font_info->desc)
@ -316,7 +323,7 @@ print_glyphs (struct grub_font_info *font_info)
else if ((x >= 0) &&
(x < glyph->device_width) &&
(y >= - font_info->desc) &&
(y < font_info->size - font_info->desc))
(y < font_info->asce))
{
line[line_pos++] = ((x == 0) || (y == 0)) ? '+' : '.';
}
@ -392,7 +399,15 @@ write_font (struct grub_font_info *font_info, char *output_file)
font_info->desc = - font_info->min_y;
}
write_be16_section ("ASCE", font_info->size - font_info->desc, &offset, file);
if (! font_info->asce)
{
if (font_info->max_y <= 0)
font_info->asce = 1;
else
font_info->asce = font_info->max_y;
}
write_be16_section ("ASCE", font_info->asce, &offset, file);
write_be16_section ("DESC", font_info->desc, &offset, file);
if (font_verbosity > 0)
@ -400,7 +415,7 @@ write_font (struct grub_font_info *font_info, char *output_file)
printf ("Font name: %s\n", font_name);
printf ("Max width: %d\n", font_info->max_width);
printf ("Max height: %d\n", font_info->max_height);
printf ("Font ascent: %d\n", font_info->size - font_info->desc);
printf ("Font ascent: %d\n", font_info->asce);
printf ("Font descent: %d\n", font_info->desc);
}
@ -560,6 +575,10 @@ main (int argc, char *argv[])
font_info.desc = strtoul (optarg, NULL, 0);
break;
case 'e':
font_info.asce = strtoul (optarg, NULL, 0);
break;
case 'h':
usage (0);
break;

View file

@ -1437,9 +1437,9 @@ static int FDECL1(padblock_write, FILE *, outfile)
if (! fp)
error (1, errno, _("Unable to open %s"), boot_image_embed);
if (fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp) == 0)
error (1, errno, _("cannot read %llu bytes from %s"),
(size_t) (2048 * PADBLOCK_SIZE), boot_image_embed);
if (fread (buffer, 1, 2048 * PADBLOCK_SIZE, fp) == 0)
error (1, errno, _("cannot read %d bytes from %s"),
2048 * PADBLOCK_SIZE, boot_image_embed);
if (fgetc (fp) != EOF)
error (1, 0, _("%s is too big for embed area"), boot_image_embed);
}

View file

@ -223,7 +223,7 @@ main (int argc, char *argv[])
set_program_name (argv[0]);
grub_util_init_ls ();
grub_util_init_nls ();
while (1)
{