[PATCH] osinfo-db-import: fix loading of local files

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

 



When the argument can be either a URI or a local path, it the
g_file_new_for_commandline_arg constructor must be used. In
addition, when the GFile is a native path, we must not use the original
path, but instead call g_file_get_path(), so that file:/// URIs are
correctly handled by stripping the protocol.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---

Pushed as a build fix

 tools/osinfo-db-import.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
index 91a7125..920f71b 100644
--- a/tools/osinfo-db-import.c
+++ b/tools/osinfo-db-import.c
@@ -318,7 +318,7 @@ static int osinfo_db_import_extract(GFile *target,
         source = NULL;
 
     if (source != NULL) {
-        file = g_file_new_for_uri(source);
+        file = g_file_new_for_commandline_arg(source);
         if (file == NULL)
             goto cleanup;
 
@@ -327,7 +327,7 @@ static int osinfo_db_import_extract(GFile *target,
             if (osinfo_db_import_download_file(file, &source_file) < 0)
                 goto cleanup;
         } else {
-            source_file = g_strdup(source);
+            source_file = g_file_get_path(file);
         }
         if (source_file == NULL)
             goto cleanup;
-- 
2.19.2

_______________________________________________
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