[Libosinfo] [libosinfo] media: Remove ISO header strings' padding

Fabiano Fidêncio fidencio at redhat.com
Fri Dec 23 07:26:44 UTC 2016


The strings in the ISO header ("volume-id", "system-id", "publisher-id"
and "application-id") have a predefined size and are padded with spaces,
but nothing in on_{pvd,svd}_read() removes these padding spaces from
those strings, which makes osinfo_media_get_volume_id() always return
[SOME-ISO-LABEL                  ] rather than the expected
[SOME-ISO-LABEL].

Resolves: rhbz#1408271

Signed-off-by: Fabiano Fidêncio <fabiano at fidencio.org>
Reported-by: Allan Day <aday at redhat.com>
---
 osinfo/osinfo_media.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index b45f4f4..af4bb14 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -712,6 +712,7 @@ static void on_svd_read(GObject *source,
 
 
     data->svd.system[MAX_SYSTEM - 1] = 0;
+    g_strchomp(data->svd.system);
 
     if (strncmp(BOOTABLE_TAG, data->svd.system, sizeof(BOOTABLE_TAG)) != 0) {
         g_set_error(&error,
@@ -803,9 +804,16 @@ static void on_pvd_read(GObject *source,
     }
 
     data->pvd.volume[MAX_VOLUME - 1] = 0;
+    g_strchomp(data->pvd.volume);
+
     data->pvd.system[MAX_SYSTEM - 1] = 0;
+    g_strchomp(data->pvd.system);
+
     data->pvd.publisher[MAX_PUBLISHER - 1] = 0;
+    g_strchomp(data->pvd.publisher);
+
     data->pvd.application[MAX_APPLICATION - 1] = 0;
+    g_strchomp(data->pvd.application);
 
     if (is_str_empty(data->pvd.volume)) {
         g_set_error(&error,
-- 
2.9.3




More information about the Libosinfo mailing list