]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Small refactor
authorAndrea Bolognani <abologna@redhat.com>
Tue, 25 Apr 2023 14:11:07 +0000 (16:11 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 10 May 2023 16:54:04 +0000 (18:54 +0200)
Prepare for further changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/util/virfile.c

index 228482e8f8c7557f119a1ce53c47db21047f25e5..8e94d19e45ef9c7d150e7d1bc17e897878997645 100644 (file)
@@ -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;
 }