android: Fix the get_mac_address() function on Android. For some reason we cannot link against the ether_ntoa function.

This commit is contained in:
Rom Walton 2013-12-03 10:20:44 -05:00
parent d204b77d42
commit 229c1c50be
1 changed files with 10 additions and 1 deletions

View File

@ -263,7 +263,16 @@ int get_mac_address(char* address) {
}
hw_addr = (struct ether_addr *)&(item->lifr_lifru.lifru_enaddr);
#endif
#ifdef _ANDROID
snprintf(
address, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
hw_addr->ether_addr_octet[0], hw_addr->ether_addr_octet[1],
hw_addr->ether_addr_octet[2], hw_addr->ether_addr_octet[3],
hw_addr->ether_addr_octet[4], hw_addr->ether_addr_octet[5]
);
#else
strcpy(address, ether_ntoa(hw_addr));
#endif
if (strstr(item->ifr_ifrn.ifrn_name, "eth")) break;
}
close(sck);