[PATCH 03/16] sanlock: Use virStrcpy instead of virStrncpy

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

 



We want a (possibly truncated) copy of the full source string so
virStrcpy is a better fit.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/locking/lock_driver_sanlock.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index aaffe30e6f..1d8f109375 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -924,9 +924,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,

     /* sanlock doesn't use owner_name for anything, so it's safe to take just
      * the first SANLK_NAME_LEN - 1 characters from vm_name */
-    ignore_value(virStrncpy(opt->owner_name, priv->vm_name,
-                            MIN(strlen(priv->vm_name), SANLK_NAME_LEN - 1),
-                            SANLK_NAME_LEN));
+    virStrcpy(opt->owner_name, priv->vm_name, SANLK_NAME_LEN);

     if (state && STRNEQ(state, "")) {
         if ((rv = sanlock_state_to_args((char *)state,
-- 
2.29.2




[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