[PATCH v2 4/8] src: Use virStrcpy() wherever possible

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

 



virStrncpy() allows us to copy a substring, but if we're
going to copy the entire thing it's much more convenient
to use virStrcpy() instead.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/util/virnetdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 57ebd0ec03..017786ce43 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2763,8 +2763,7 @@ static int virNetDevParseMcast(char *buf, virNetDevMcastEntryPtr mcast)
                 mcast->idx = num;
                 break;
             case VIR_MCAST_TYPE_NAME_TOKEN:
-                if (virStrncpy(mcast->name, token, strlen(token),
-                    VIR_MCAST_NAME_LEN) == NULL) {
+                if (virStrcpy(mcast->name, token, VIR_MCAST_NAME_LEN) == NULL) {
                     virReportSystemError(EINVAL,
                                          _("Failed to parse network device name from '%s'"),
                                          buf);
-- 
2.17.1

--
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