From 8ac1d88df12193906ceb95823fc64bd70b1d38a2 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 19 Nov 2013 02:13:22 -0800 Subject: [PATCH] client: On Macintosh, return MAC address for first Ethernet controller only. --- client/mac_address.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/mac_address.cpp b/client/mac_address.cpp index 1ad7bdddb9..3206bca365 100644 --- a/client/mac_address.cpp +++ b/client/mac_address.cpp @@ -112,9 +112,7 @@ GetMACAddress(io_iterator_t intfIterator, char* buffer) io_object_t intfService; io_object_t controllerService; kern_return_t kernResult = KERN_FAILURE; - char delimiter[2] = "\0"; - *buffer = '\0'; while ((intfService = IOIteratorNext(intfIterator))) { CFTypeRef MACAddressAsCFData; @@ -133,12 +131,9 @@ GetMACAddress(io_iterator_t intfIterator, char* buffer) UInt8 MACAddress[ kIOEthernetAddressSize ]; CFDataGetBytes(refData, CFRangeMake(0,CFDataGetLength(refData)), MACAddress); - sprintf(buffer, "%s%s%02x:%02x:%02x:%02x:%02x:%02x", - buffer, delimiter, + sprintf(buffer, "%02x:%02x:%02x:%02x:%02x:%02x", MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], MACAddress[4], MACAddress[5]); CFRelease(MACAddressAsCFData); - delimiter[0] = ':'; - delimiter[1] = '\0'; } (void) IOObjectRelease(controllerService); }