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

Re: [libvirt] [PATCH v2 01/10] locking: use virStrcpyStatic instead of memcpy

On 01/18/13 14:50, John Ferlan wrote:
  src/locking/lock_driver_sanlock.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

Next time please start a new thread with V2 patches. It's easy to overlook them in an existing thread.

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 0b7c6d5..95f7d61 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -206,7 +206,14 @@ static int virLockManagerSanlockSetupLockspace(void)
          goto error;

+    if (!virStrcpyStatic(ls.name,
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Lockspace path '%s' exceeded %d characters"),
+                       SANLK_PATH_LEN);
+        goto error;
+    }

Hm the error message will trigger only if we ever change the length of VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE. I think that it won't ever happen but this might be a good sanity check.

      ls.host_id = 0; /* Doesn't matter for initialization */
      ls.flags = 0;
      if (!virStrcpy(ls.host_id_disk.path, path, SANLK_PATH_LEN)) {

If nobody else responds otherwise till tomorrow, I will push the patch as-is.


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