]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: Use virStrcpy() wherever possible
authorAndrea Bolognani <abologna@redhat.com>
Fri, 20 Jul 2018 11:00:34 +0000 (13:00 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 23 Jul 2018 12:27:25 +0000 (14:27 +0200)
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@redhat.com>
src/util/virnetdev.c

index 57ebd0ec03cfccb632e65f0f32e476ff5c89e119..017786ce43d8a20e54a1916d5798dbd04665cee6 100644 (file)
@@ -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);