[PATCH 49/75] node_device: Use g_strdup_printf() instead of virAsprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/node_device/node_device_driver.c | 2 +-
 src/node_device/node_device_hal.c    | 4 ++--
 src/node_device/node_device_udev.c   | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 53373140be..148ae15fed 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -113,7 +113,7 @@ nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def)
 
     VIR_FREE(def->driver);
 
-    virAsprintf(&driver_link, "%s/driver", def->sysfs_path);
+    driver_link = g_strdup_printf("%s/driver", def->sysfs_path);
 
     /* Some devices don't have an explicit driver, so just return
        without a name */
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index a6042e6bfc..b40f93df46 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -614,13 +614,13 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED,
     nodeDeviceLock();
 
     if (privileged) {
-        virAsprintf(&driver->stateDir, "%s/libvirt/nodedev", RUNSTATEDIR);
+        driver->stateDir = g_strdup_printf("%s/libvirt/nodedev", RUNSTATEDIR);
     } else {
         g_autofree char *rundir = NULL;
 
         if (!(rundir = virGetUserRuntimeDirectory()))
             goto failure;
-        virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir);
+        driver->stateDir = g_strdup_printf("%s/nodedev/run", rundir);
     }
 
     if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 92d7048ece..dc440daead 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1028,7 +1028,7 @@ udevProcessMediatedDevice(struct udev_device *dev,
      * it by waiting for the attributes to become available.
      */
 
-    virAsprintf(&linkpath, "%s/mdev_type", udev_device_get_syspath(dev));
+    linkpath = g_strdup_printf("%s/mdev_type", udev_device_get_syspath(dev));
 
     if (virFileWaitForExists(linkpath, 1, 100) < 0) {
         virReportSystemError(errno,
@@ -1810,13 +1810,13 @@ nodeStateInitialize(bool privileged,
     driver->privileged = privileged;
 
     if (privileged) {
-        virAsprintf(&driver->stateDir, "%s/libvirt/nodedev", RUNSTATEDIR);
+        driver->stateDir = g_strdup_printf("%s/libvirt/nodedev", RUNSTATEDIR);
     } else {
         g_autofree char *rundir = NULL;
 
         if (!(rundir = virGetUserRuntimeDirectory()))
             goto cleanup;
-        virAsprintf(&driver->stateDir, "%s/nodedev/run", rundir);
+        driver->stateDir = g_strdup_printf("%s/nodedev/run", rundir);
     }
 
     if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux