virfile: Replace AbsPath judgement method with g_path_is_absolute()

The g_path_is_absolute() considers more situations
than just a simply "path[0] == '/'".

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12
Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Luke Yue 2021-04-12 22:04:27 +08:00 committed by Michal Privoznik
parent f0e1e31bf7
commit dfc0c11054

View File

@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED,
int
virFileAbsPath(const char *path, char **abspath)
{
if (path[0] == '/') {
if (g_path_is_absolute(path)) {
*abspath = g_strdup(path);
} else {
g_autofree char *buf = g_get_current_dir();