diff --git a/ChangeLog b/ChangeLog index 9895a2fb3..745664b67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-12-17 Vladimir Serbinenko + + Use grub_xasprintf to format translated error messages containing + 64-bit quantity. + 2013-12-17 Jon McCune Fix double-free introduced by commit 33d02a42d64cf06cada1c389 diff --git a/util/grub-fstest.c b/util/grub-fstest.c index 23dd558e4..4ff723c51 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -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; 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)) break; @@ -128,7 +131,9 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void 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; } @@ -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); if (sz < 0) { - grub_util_error (_("read error at offset %llu: %s"), - (unsigned long long) ofs, grub_errmsg); + char *msg = grub_xasprintf (_("read error at offset %llu: %s"), + (unsigned long long) ofs, grub_errmsg); + grub_util_error ("%s", msg); break; } @@ -233,8 +239,9 @@ cmp_hook (grub_off_t ofs, char *buf, int len, void *ff_in) static char buf_1[BUF_SIZE]; if ((int) fread (buf_1, 1, len, ff) != len) { - grub_util_error (_("read error at offset %llu: %s"), - (unsigned long long) ofs, grub_errmsg); + char *msg = grub_xasprintf (_("read error at offset %llu: %s"), + (unsigned long long) ofs, grub_errmsg); + grub_util_error ("%s", msg); 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++) if (buf_1[i] != buf[i]) { - grub_util_error (_("compare fail at offset %llu"), - (unsigned long long) ofs); + char *msg = grub_xasprintf (_("compare fail at offset %llu"), + (unsigned long long) ofs); + grub_util_error ("%s", msg); return 1; } } diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index a5ef0bfd2..19d94e7f2 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -1376,11 +1376,15 @@ SUFFIX (locate_sections) (const char *kernel_path, - image_target->link_addr; if (grub_host_to_target_addr (s->sh_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?"), - kernel_path, - (unsigned long long) grub_host_to_target_addr (s->sh_addr), - (unsigned long long) image_target->link_addr); + { + char *msg + = grub_xasprintf (_("`%s' is miscompiled: it's start address is 0x%llx" + " instead of 0x%llx: ld.gold bug?"), + 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; current_address += grub_host_to_target_addr (s->sh_size);