Use grub_xasprintf to format translated error messages containing
64-bit quantity.
This commit is contained in:
parent
24d5934daa
commit
f4dab3d1ac
3 changed files with 31 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-12-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Use grub_xasprintf to format translated error messages containing
|
||||||
|
64-bit quantity.
|
||||||
|
|
||||||
2013-12-17 Jon McCune <jonmccune@google.com>
|
2013-12-17 Jon McCune <jonmccune@google.com>
|
||||||
|
|
||||||
Fix double-free introduced by commit 33d02a42d64cf06cada1c389
|
Fix double-free introduced by commit 33d02a42d64cf06cada1c389
|
||||||
|
|
|
@ -99,8 +99,11 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
|
||||||
len = (leng > BUF_SIZE) ? BUF_SIZE : leng;
|
len = (leng > BUF_SIZE) ? BUF_SIZE : leng;
|
||||||
|
|
||||||
if (grub_disk_read (dev->disk, 0, skip, len, buf))
|
if (grub_disk_read (dev->disk, 0, skip, len, buf))
|
||||||
grub_util_error (_("disk read fails at offset %lld, length %lld"),
|
{
|
||||||
(long long) skip, (long long) len);
|
char *msg = grub_xasprintf (_("disk read fails at offset %lld, length %lld"),
|
||||||
|
(long long) skip, (long long) len);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (hook (skip, buf, len, hook_arg))
|
if (hook (skip, buf, len, hook_arg))
|
||||||
break;
|
break;
|
||||||
|
@ -128,7 +131,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
|
||||||
|
|
||||||
if (skip > file->size)
|
if (skip > file->size)
|
||||||
{
|
{
|
||||||
grub_util_error (_("invalid skip value %lld"), (unsigned long long) skip);
|
char *msg = grub_xasprintf (_("invalid skip value %lld"),
|
||||||
|
(unsigned long long) skip);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,8 +153,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
|
||||||
sz = grub_file_read (file, buf, (len > BUF_SIZE) ? BUF_SIZE : len);
|
sz = grub_file_read (file, buf, (len > BUF_SIZE) ? BUF_SIZE : len);
|
||||||
if (sz < 0)
|
if (sz < 0)
|
||||||
{
|
{
|
||||||
grub_util_error (_("read error at offset %llu: %s"),
|
char *msg = grub_xasprintf (_("read error at offset %llu: %s"),
|
||||||
(unsigned long long) ofs, grub_errmsg);
|
(unsigned long long) ofs, grub_errmsg);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +239,9 @@ cmp_hook (grub_off_t ofs, char *buf, int len, void *ff_in)
|
||||||
static char buf_1[BUF_SIZE];
|
static char buf_1[BUF_SIZE];
|
||||||
if ((int) fread (buf_1, 1, len, ff) != len)
|
if ((int) fread (buf_1, 1, len, ff) != len)
|
||||||
{
|
{
|
||||||
grub_util_error (_("read error at offset %llu: %s"),
|
char *msg = grub_xasprintf (_("read error at offset %llu: %s"),
|
||||||
(unsigned long long) ofs, grub_errmsg);
|
(unsigned long long) ofs, grub_errmsg);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +252,9 @@ cmp_hook (grub_off_t ofs, char *buf, int len, void *ff_in)
|
||||||
for (i = 0; i < len; i++, ofs++)
|
for (i = 0; i < len; i++, ofs++)
|
||||||
if (buf_1[i] != buf[i])
|
if (buf_1[i] != buf[i])
|
||||||
{
|
{
|
||||||
grub_util_error (_("compare fail at offset %llu"),
|
char *msg = grub_xasprintf (_("compare fail at offset %llu"),
|
||||||
(unsigned long long) ofs);
|
(unsigned long long) ofs);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1376,11 +1376,15 @@ SUFFIX (locate_sections) (const char *kernel_path,
|
||||||
- image_target->link_addr;
|
- image_target->link_addr;
|
||||||
if (grub_host_to_target_addr (s->sh_addr)
|
if (grub_host_to_target_addr (s->sh_addr)
|
||||||
!= image_target->link_addr)
|
!= image_target->link_addr)
|
||||||
grub_util_error (_("`%s' is miscompiled: it's start address is 0x%llx"
|
{
|
||||||
" instead of 0x%llx: ld.gold bug?"),
|
char *msg
|
||||||
kernel_path,
|
= grub_xasprintf (_("`%s' is miscompiled: it's start address is 0x%llx"
|
||||||
(unsigned long long) grub_host_to_target_addr (s->sh_addr),
|
" instead of 0x%llx: ld.gold bug?"),
|
||||||
(unsigned long long) image_target->link_addr);
|
kernel_path,
|
||||||
|
(unsigned long long) grub_host_to_target_addr (s->sh_addr),
|
||||||
|
(unsigned long long) image_target->link_addr);
|
||||||
|
grub_util_error ("%s", msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
section_addresses[i] = current_address;
|
section_addresses[i] = current_address;
|
||||||
current_address += grub_host_to_target_addr (s->sh_size);
|
current_address += grub_host_to_target_addr (s->sh_size);
|
||||||
|
|
Loading…
Reference in a new issue