]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virFileLoopDeviceAssociate: Use virStrcpy instead of virStrncpy
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Mar 2021 11:50:36 +0000 (12:50 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 5 Mar 2021 14:01:29 +0000 (15:01 +0100)
Passing 'strlen(src)' for length makes it equivalent to virStrcpy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virfile.c

index d1da619666b631105c6c580759a1d7b960368a6f..180f2af4054b7feebf8ae87e4d344dee9a8bb199 100644 (file)
@@ -810,8 +810,7 @@ int virFileLoopDeviceAssociate(const char *file,
     lo.lo_flags = LO_FLAGS_AUTOCLEAR;
 
     /* Set backing file name for LOOP_GET_STATUS64 queries */
-    if (virStrncpy((char *) lo.lo_file_name, file,
-                   strlen(file), LO_NAME_SIZE) < 0) {
+    if (virStrcpy((char *) lo.lo_file_name, file, LO_NAME_SIZE) < 0) {
         virReportSystemError(errno,
                              _("Unable to set backing file %s"), file);
         goto cleanup;