summaryrefslogtreecommitdiff
path: root/contrib/hyperv
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2014-09-25 22:22:57 +0000
committerXin LI <delphij@FreeBSD.org>2014-09-25 22:22:57 +0000
commit97d15a9372c4cff75a11e0d6a24d37211400a06e (patch)
tree6c9eac0c0ec2619052dc7fb943e8e494b9764a81 /contrib/hyperv
parenta6733ed126558d52d0de4ca33303c5e0ae26319d (diff)
downloadsrc-test-97d15a9372c4cff75a11e0d6a24d37211400a06e.tar.gz
src-test-97d15a9372c4cff75a11e0d6a24d37211400a06e.zip
Use a char * as iterator over a bounded string.
MFC after: 1 week
Notes
Notes: svn path=/head/; revision=272143
Diffstat (limited to 'contrib/hyperv')
-rw-r--r--contrib/hyperv/tools/hv_kvp_daemon.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/contrib/hyperv/tools/hv_kvp_daemon.c b/contrib/hyperv/tools/hv_kvp_daemon.c
index 25b2770c82625..b0a84d411095a 100644
--- a/contrib/hyperv/tools/hv_kvp_daemon.c
+++ b/contrib/hyperv/tools/hv_kvp_daemon.c
@@ -601,8 +601,7 @@ kvp_mac_to_if_name(char *mac)
struct ifaddrs *head_ifaddrs_ptr;
struct sockaddr_dl *sdl;
int status;
- size_t i;
- char *buf_ptr;
+ char *buf_ptr, *p;
status = getifaddrs(&ifaddrs_ptr);
@@ -613,8 +612,8 @@ kvp_mac_to_if_name(char *mac)
if (sdl->sdl_type == IFT_ETHER) {
buf_ptr = strdup(ether_ntoa((struct ether_addr *)(LLADDR(sdl))));
if (buf_ptr != NULL) {
- for (i = 0; i < strlen(buf_ptr); i++)
- buf_ptr[i] = toupper(buf_ptr[i]);
+ for (p = buf_ptr; *p != '\0'; p++)
+ *p = toupper(*p);
if (strncmp(buf_ptr, mac, strlen(mac)) == 0) {
/* Caller will free the memory */