]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virfile: Replace AbsPath judgement method with g_path_is_absolute()
authorLuke Yue <lukedyue@gmail.com>
Mon, 12 Apr 2021 14:04:27 +0000 (22:04 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Apr 2021 11:08:42 +0000 (13:08 +0200)
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>
src/util/virfile.c

index 93fac200cc4045397ad6dc10b7df6d74de71a604..3311eaff3d5caefec331060c9b886b42196c635f 100644 (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();