From: Luke Yue Date: Mon, 12 Apr 2021 14:04:27 +0000 (+0800) Subject: virfile: Replace AbsPath judgement method with g_path_is_absolute() X-Git-Tag: v7.3.0-rc1~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfc0c11054963f7eae31f6aa89f1506bf0bcfb27;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Michal Privoznik --- diff --git a/src/util/virfile.c b/src/util/virfile.c index 93fac200cc..3311eaff3d 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -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();