[libvirt PATCH 1/5] util: Small refactor

Andrea Bolognani abologna at redhat.com
Fri May 5 18:01:42 UTC 2023


Prepare for further changes.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/util/virfile.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 228482e8f8..8e94d19e45 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1743,13 +1743,15 @@ virFindFileInPath(const char *file)
         return NULL;
 
     path = g_find_program_in_path(file);
-    if (!path)
-        return NULL;
 
-    /* Workaround for a bug in g_find_program_in_path() not returning absolute
-     * path as documented. TODO drop it once we require GLib >= 2.69.0
-     */
-    return g_canonicalize_filename(path, NULL);
+    if (path) {
+        /* Workaround for a bug in g_find_program_in_path() not returning absolute
+         * path as documented. TODO drop it once we require GLib >= 2.69.0
+         */
+        return g_canonicalize_filename(path, NULL);
+    }
+
+    return NULL;
 }
 
 
-- 
2.40.1



More information about the libvir-list mailing list