[libosinfo] media: Remove ISO header strings' padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
Reported-by: Allan Day <aday@xxxxxxxxxx>
---
 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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux