[PATCH 45/75] locking: 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/locking/lock_daemon.c         | 8 ++++----
 src/locking/lock_daemon_config.c  | 2 +-
 src/locking/lock_driver_lockd.c   | 4 ++--
 src/locking/lock_driver_sanlock.c | 8 ++++----
 src/locking/lock_manager.c        | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index dc23179009..2fa3238794 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -464,8 +464,8 @@ virLockDaemonUnixSocketPaths(bool privileged,
         }
         umask(old_umask);
 
-        virAsprintf(sockfile, "%s/virtlockd-sock", rundir);
-        virAsprintf(adminSockfile, "%s/virtlockd-admin-sock", rundir);
+        *sockfile = g_strdup_printf("%s/virtlockd-sock", rundir);
+        *adminSockfile = g_strdup_printf("%s/virtlockd-admin-sock", rundir);
 
         VIR_FREE(rundir);
     }
@@ -841,7 +841,7 @@ virLockDaemonExecRestartStatePath(bool privileged,
         }
         umask(old_umask);
 
-        virAsprintf(state_file, "%s/virtlockd-restart-exec.json", rundir);
+        *state_file = g_strdup_printf("%s/virtlockd-restart-exec.json", rundir);
 
         VIR_FREE(rundir);
     }
@@ -858,7 +858,7 @@ virLockDaemonGetExecRestartMagic(void)
 {
     char *ret;
 
-    virAsprintf(&ret, "%lld", (long long int)getpid());
+    ret = g_strdup_printf("%lld", (long long int)getpid());
     return ret;
 }
 
diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c
index e77e2b7bf6..d7e13013d7 100644
--- a/src/locking/lock_daemon_config.c
+++ b/src/locking/lock_daemon_config.c
@@ -46,7 +46,7 @@ virLockDaemonConfigFilePath(bool privileged, char **configfile)
         if (!(configdir = virGetUserConfigDirectory()))
             goto error;
 
-        virAsprintf(configfile, "%s/virtlockd.conf", configdir);
+        *configfile = g_strdup_printf("%s/virtlockd.conf", configdir);
         VIR_FREE(configdir);
     }
 
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 73f699044b..e8f0329b05 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -127,7 +127,7 @@ static char *virLockManagerLockDaemonPath(bool privileged)
         if (!(rundir = virGetUserRuntimeDirectory()))
             return NULL;
 
-        virAsprintf(&path, "%s/virtlockd-sock", rundir);
+        path = g_strdup_printf("%s/virtlockd-sock", rundir);
 
         VIR_FREE(rundir);
     }
@@ -574,7 +574,7 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock,
                            _("Missing path or lockspace for lease resource"));
             goto cleanup;
         }
-        virAsprintf(&newLockspace, "%s/%s", path, lockspace);
+        newLockspace = g_strdup_printf("%s/%s", path, lockspace);
         newName = g_strdup(name);
 
     }   break;
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 55f0a3621d..31fbfb5d7e 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -103,7 +103,7 @@ virLockManagerSanlockError(int err,
 #if HAVE_SANLOCK_STRERROR
         *message = g_strdup(sanlock_strerror(err));
 #else
-        virAsprintf(message, _("sanlock error %d"), err);
+        message = g_strdup_printf(_("sanlock error %d"), err);
 #endif
         return true;
     } else {
@@ -211,8 +211,8 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver)
     char *dir = NULL;
     int retries = LOCKSPACE_RETRIES;
 
-    virAsprintf(&path, "%s/%s", driver->autoDiskLeasePath,
-                VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE);
+    path = g_strdup_printf("%s/%s", driver->autoDiskLeasePath,
+                           VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE);
 
     if (virStrcpyStatic(ls.name,
                         VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE) < 0) {
@@ -643,7 +643,7 @@ virLockManagerSanlockAddDisk(virLockManagerSanlockDriverPtr driver,
         goto cleanup;
     }
 
-    virAsprintf(&path, "%s/%s", driver->autoDiskLeasePath, res->name);
+    path = g_strdup_printf("%s/%s", driver->autoDiskLeasePath, res->name);
     if (virStrcpy(res->disks[0].path, path, SANLK_PATH_LEN) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Lease path '%s' exceeds %d characters"),
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 0986cafe6c..07318fb53f 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -131,7 +131,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
     VIR_DEBUG("name=%s driverName=%s configDir=%s flags=0x%x",
               name, driverName, configDir, flags);
 
-    virAsprintf(&configFile, "%s/%s-%s.conf", configDir, driverName, name);
+    configFile = g_strdup_printf("%s/%s-%s.conf", configDir, driverName, name);
 
     if (STREQ(name, "nop")) {
         driver = &virLockDriverNop;
-- 
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