lib: Replace virBuildPath() with g_build_filename()

Our virBuildPath() constructs a path from given arguments.
Exactly like g_build_filename(), except the latter is more
generic as it uses backslashes on Windows. Therefore, replace the
former with the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2023-10-16 09:40:58 +02:00
parent 0c5f37364f
commit 394533f69f
4 changed files with 6 additions and 6 deletions

View File

@ -444,7 +444,7 @@ src/util/hooks.c
g_autofree char *path = NULL;
g_autoptr(virCommand) cmd = NULL;
virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
path = g_build_filename(LIBVIRT_HOOK_DIR, drvstr, NULL);
cmd = virCommandNew(path);

View File

@ -38,7 +38,7 @@ virFCIsCapableRport(const char *rport)
{
g_autofree char *path = NULL;
virBuildPath(&path, SYSFS_FC_RPORT_PATH, rport);
path = g_build_filename(SYSFS_FC_RPORT_PATH, rport, NULL);
return virFileExists(path);
}

View File

@ -153,7 +153,7 @@ virHookCheck(int no, const char *driver)
return -1;
}
virBuildPath(&path, LIBVIRT_HOOK_DIR, driver);
path = g_build_filename(LIBVIRT_HOOK_DIR, driver, NULL);
if (!virFileExists(path)) {
VIR_DEBUG("No hook script %s", path);
@ -398,7 +398,7 @@ virHookCall(int driver,
if (extra == NULL)
extra = "-";
virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
path = g_build_filename(LIBVIRT_HOOK_DIR, drvstr, NULL);
script_ret = 1;

View File

@ -2396,7 +2396,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path,
*pf = NULL;
virBuildPath(&device_link, vf_sysfs_path, "physfn");
device_link = g_build_filename(vf_sysfs_path, "physfn", NULL);
if ((*pf = virPCIGetDeviceAddressFromSysfsLink(device_link))) {
VIR_DEBUG("PF for VF device '%s': " VIR_PCI_DEVICE_ADDRESS_FMT,
@ -2580,7 +2580,7 @@ virPCIGetNetName(const char *device_link_sysfs_path,
return -1;
}
virBuildPath(&pcidev_sysfs_net_path, device_link_sysfs_path, "net");
pcidev_sysfs_net_path = g_build_filename(device_link_sysfs_path, "net", NULL);
if (virDirOpenQuiet(&dir, pcidev_sysfs_net_path) < 0) {
/* this *isn't* an error - caller needs to check for netname == NULL */