virFindFileInPath: Don't pass NULL to g_canonicalize_filename()

If given file is not found in $PATH then g_find_program_in_path()
returns NULL. However, g_canonicalize_filename() does not accept
NULL as input.

Fixes: 65c2901906
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2021-06-15 18:01:37 +02:00
parent 49d47342b3
commit 9a51edebf8

View File

@ -1667,6 +1667,8 @@ 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. This has been fixed in