mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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:
parent
f0e1e31bf7
commit
dfc0c11054
@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED,
|
|||||||
int
|
int
|
||||||
virFileAbsPath(const char *path, char **abspath)
|
virFileAbsPath(const char *path, char **abspath)
|
||||||
{
|
{
|
||||||
if (path[0] == '/') {
|
if (g_path_is_absolute(path)) {
|
||||||
*abspath = g_strdup(path);
|
*abspath = g_strdup(path);
|
||||||
} else {
|
} else {
|
||||||
g_autofree char *buf = g_get_current_dir();
|
g_autofree char *buf = g_get_current_dir();
|
||||||
|
Loading…
Reference in New Issue
Block a user