mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
node_device: Use g_strdup_printf() instead of virAsprintf()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
52a6b45e18
commit
7847f011b0
@ -113,8 +113,7 @@ nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def)
|
|||||||
|
|
||||||
VIR_FREE(def->driver);
|
VIR_FREE(def->driver);
|
||||||
|
|
||||||
if (virAsprintf(&driver_link, "%s/driver", def->sysfs_path) < 0)
|
driver_link = g_strdup_printf("%s/driver", def->sysfs_path);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* Some devices don't have an explicit driver, so just return
|
/* Some devices don't have an explicit driver, so just return
|
||||||
without a name */
|
without a name */
|
||||||
|
@ -614,16 +614,13 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED,
|
|||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if (virAsprintf(&driver->stateDir,
|
driver->stateDir = g_strdup_printf("%s/libvirt/nodedev", RUNSTATEDIR);
|
||||||
"%s/libvirt/nodedev", RUNSTATEDIR) < 0)
|
|
||||||
goto failure;
|
|
||||||
} else {
|
} else {
|
||||||
g_autofree char *rundir = NULL;
|
g_autofree char *rundir = NULL;
|
||||||
|
|
||||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||||
goto failure;
|
goto failure;
|
||||||
if (virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir) < 0)
|
driver->stateDir = g_strdup_printf("%s/nodedev/run", rundir);
|
||||||
goto failure;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
|
if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
|
||||||
|
@ -1025,9 +1025,7 @@ udevProcessMediatedDevice(struct udev_device *dev,
|
|||||||
* it by waiting for the attributes to become available.
|
* it by waiting for the attributes to become available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (virAsprintf(&linkpath, "%s/mdev_type",
|
linkpath = g_strdup_printf("%s/mdev_type", udev_device_get_syspath(dev));
|
||||||
udev_device_get_syspath(dev)) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virFileWaitForExists(linkpath, 1, 100) < 0) {
|
if (virFileWaitForExists(linkpath, 1, 100) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
@ -1809,16 +1807,13 @@ nodeStateInitialize(bool privileged,
|
|||||||
driver->privileged = privileged;
|
driver->privileged = privileged;
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if (virAsprintf(&driver->stateDir,
|
driver->stateDir = g_strdup_printf("%s/libvirt/nodedev", RUNSTATEDIR);
|
||||||
"%s/libvirt/nodedev", RUNSTATEDIR) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
} else {
|
} else {
|
||||||
g_autofree char *rundir = NULL;
|
g_autofree char *rundir = NULL;
|
||||||
|
|
||||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir) < 0)
|
driver->stateDir = g_strdup_printf("%s/nodedev/run", rundir);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
|
if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user