From d2d58d0ab46ae70d997dcf0a8f0dc8a27a3eed81 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 19 Mar 2012 11:07:28 +0100 Subject: [PATCH] * grub-core/fs/jfs.c (grub_jfs_label): Use first label if second one starts with control character. --- ChangeLog | 5 +++++ grub-core/fs/jfs.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 338522b78..60df3dbcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-03-19 Vladimir Serbinenko + + * grub-core/fs/jfs.c (grub_jfs_label): Use first label if second one + starts with control character. + 2012-03-19 Vladimir Serbinenko * grub-core/gdb/cstub.c (grub_gdb_inbuf): Increase the size to avoid diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c index b323fe0c8..4792f3a74 100644 --- a/grub-core/fs/jfs.c +++ b/grub-core/fs/jfs.c @@ -888,12 +888,18 @@ grub_jfs_label (grub_device_t device, char **label) if (data) { - if (data->sblock.volname2[0]) + if (data->sblock.volname2[0] < ' ') + { + char *ptr; + ptr = data->sblock.volname + sizeof (data->sblock.volname) - 1; + while (ptr >= data->sblock.volname && *ptr == ' ') + ptr--; + *label = grub_strndup (data->sblock.volname, + ptr - data->sblock.volname + 1); + } + else *label = grub_strndup (data->sblock.volname2, sizeof (data->sblock.volname2)); - else - *label = grub_strndup (data->sblock.volname, - sizeof (data->sblock.volname)); } else *label = 0;